Results 1 to 8 of 8

Thread: Weird error

  1. #1
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default Weird error




    Simba Code:
    {$include_once GLX/Setup.Simba}
    type RsInterfaces = (INTERFACE_MINIMAP, INTERFACE_ACTIONBAR, INTERFACE_CONTROLPANEL, INTERFACE_INVENTORY, INTERFACE_CHAT);

    begin
      writeln(INTERFACE_INVENTORY);
    end.

    when i uncomment {$include_once GLX/Setup.Simba}:
    Exception in Script: Unknown declaration "INTERFACE_INVENTORY" at line 5, column 11

    how could an include possibly causes such an error?

    @Brandon
    @Dgby714

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Is your interpreter set to Lape? And are you using Simba 1.0.3?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Is your interpreter set to Lape? And are you using Simba 1.0.3?
    Yes.
    Just discovered a bunch of other weird errors with enum...

    Simba Code:
    type RsInterfaces = (az);

    begin
      writeln(az);
    end.
    Works fine.



    Simba Code:
    type RsInterfaces = (a);

    begin
      writeln(a);
    end.
    Doesn't work!

  4. #4
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Offtopic: Compiled successfully in 1092 ms.

    -- It took over 1000ms to compile 6 lines?

    Forum account issues? Please send me a PM

  5. #5
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Justin View Post
    Offtopic: Compiled successfully in 1092 ms.

    -- It took over 1000ms to compile 6 lines?
    In lape yes. Much better runtime performance (math, string manipulation etc) though.

  6. #6
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    In lape yes. Much better runtime performance (math, string manipulation etc) though.
    That include has pre-processor directives that forces the enums to not be in global scope/namespace.

    Thus to access an enum such as:

    Simba Code:
    type MyEnum = (Minimap, Inventory, Chat);

    you need to do:

    Simba Code:
    MyEnum.Minimap;
    MyEnum.Inventory;
    MyEnum.Chat;

    To remove the restrictions, open the Setup file and remove anything that says {$X ON} {$B ON} etc.. Should be at the very top of the file.

    Those are the pre-processor directives. However, according to SRL-6's standard, Enums really shouldn't be in the global scope and only accessed through their TypeIdentifier. In this case it is fine though but you may not want to make it a habit.

    See here for more on the pre-processor:
    http://villavu.com/forum/showthread....101#post854101


    P.S. It actually takes a lot longer to compile now that it is compatible with SRL-6. I kept a copy of Non-compatible include and the compatible one.
    Last edited by Brandon; 10-05-2013 at 07:54 AM.
    I am Ggzz..
    Hackintosher

  7. #7
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    That include has pre-processor directives that forces the enums to not be in global scope/namespace.

    Thus to access an enum such as:

    Simba Code:
    type MyEnum = (Minimap, Inventory, Chat);

    you need to do:

    Simba Code:
    MyEnum.Minimap;
    MyEnum.Inventory;
    MyEnum.Chat;

    To remove the restrictions, open the Setup file and remove anything that says {$X ON} {$B ON} etc.. Should be at the very top of the file.

    Those are the pre-processor directives. However, according to SRL-6's standard, Enums really shouldn't be in the global scope and only accessed through their TypeIdentifier. In this case it is fine though but you may not want to make it a habit.

    See here for more on the pre-processor:
    http://villavu.com/forum/showthread....101#post854101


    P.S. It actually takes a lot longer to compile now that it is compatible with SRL-6. I kept a copy of Non-compatible include and the compatible one.
    Thanks for the explanation! Couldn't rep you yet :p

    P.S. It actually takes a lot longer to compile now that it is compatible with SRL-6. I kept a copy of Non-compatible include and the compatible one.
    Run-time performance isn't affected right? Could you host the non-compatible one on github as well? :)

  8. #8
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    This is why we need units >..>

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •