SRL Archive - OSR Help

Weird error


riwu

2013-10-05 02:28:22




{$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

Flight

2013-10-05 02:36:11

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

riwu

2013-10-05 02:39:37

From: Flight
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…


type RsInterfaces = (az);

begin
writeln(az);
end.
Works fine.




type RsInterfaces = (a);

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

Justin

2013-10-05 03:16:05

Offtopic: Compiled successfully in 1092 ms.

– It took over 1000ms to compile 6 lines?

riwu

2013-10-05 03:42:19

From: Justin
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.

Brandon

2013-10-05 03:48:51

From: riwu
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:


type MyEnum = (Minimap, Inventory, Chat);

you need to do:


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.php?t=68613&p=854101#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.

riwu

2013-10-05 04:52:09

From: Brandon
That include has pre-processor directives that forces the enums to not be in global scope/namespace.

Thus to access an enum such as:


type MyEnum = (Minimap, Inventory, Chat);

you need to do:


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.php?t=68613&p=854101#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? :)

Dgby714

2013-10-05 23:12:46

This is why we need units >..>