SRL Archive - Reflection Development

New reflection plugin


mormonman

2011-09-28 17:17:55

This thread is for information regarding the new reflection plugin. It has not been merged into the main branch yet, but soon will be there.

No more script changes

Functions of the new plugin:
The biggest thing in the new plugin is the built in open object handling. If you read through the source you will see that any SmartGet's that have to do with objects(java objects not rsobject) have the object added to a global array.
To debug the objects that are left unfreed use: PrintOpenObjects;
To free objects that are currently loaded use: CleanSmartObjects;
To not use the memory management call: SetMemoryManagement(False);

Another huge benefit of the new plugin is the exception raising if a bad(less than 1) object pointer is sent to a SmartGet function. This drastically reduces runtime crashes and in all of my tests I have not yet come across an un-explainable crash. I have even posted some of my test runs on Harry's guard fighter and port sarim chopper.

If you have any questions/comments/concerns/rants please post them here.

ps - I might have missed something, so if you guys are lost please let me know.

@Wizzup?: Edit this thread when you do the merge.

Coh3n

2011-09-29 02:30:45

Uhm, what about scripts that have reflection as optional? With this change, you can't simply exclude reflection if you want without excluding SMART and SRL.

mormonman

2011-09-29 04:17:24

From: Coh3n
Uhm, what about scripts that have reflection as optional? With this change, you can't simply exclude reflection if you want without excluding SMART and SRL.


I didn't think of MSI :redface:

Let me sleep on it.

Coh3n

2011-09-29 11:20:06

I know MSI's probably the only script that does it (and probably always will be), but it's still nice to have the option. Maybe there's a way you can do both? Like if SMART/SRL aren't included, then define/include them?

marpis

2011-09-29 11:56:18

From: Coh3n
I know MSI's probably the only script that does it (and probably always will be), but it's still nice to have the option. Maybe there's a way you can do both? Like if SMART/SRL aren't included, then define/include them?


My MultiFighter also used to have this option ;)

euphemism

2011-09-29 12:04:23

From: Coh3n
I know MSI's probably the only script that does it (and probably always will be), but it's still nice to have the option. Maybe there's a way you can do both? Like if SMART/SRL aren't included, then define/include them?


Coh3n, the script I am writing has an option to use reflection randoms. I think this qualifies as being a script where it could be an issue.

NCDS

2011-09-29 15:30:50

It makes sense to include SMART inside reflection, but I don't really like the idea of SRL being included inside reflection as well. Should be kept separate imo.

Coh3n

2011-09-29 16:07:53

From: euphemism
Coh3n, the script I am writing has an option to use reflection randoms. I think this qualifies as being a script where it could be an issue.
It does. :)

From: NCDS
It makes sense to include SMART inside reflection, but I don't really like the idea of SRL being included inside reflection as well. Should be kept separate imo.
I can see SMART, yeah. And you can simply do:

{$IFNDEF SMART}
{$DEFINE SMART}
{$ENDIF}
Inside the reflection include.

But SRL and Reflection are separate.

mormonman

2011-09-29 16:16:16

From: Coh3n
It does. :)

I can see SMART, yeah. And you can simply do:

{$IFNDEF SMART}
{$DEFINE SMART}
{$ENDIF}
Inside the reflection include.

But SRL and Reflection are separate.


If you can come up with a better way to load the plugin then I'm listening, but our plugin loads smart. It has to.

Coh3n

2011-09-29 16:19:06

From: mormonman
If you can come up with a better way to load the plugin then I'm listening, but our plugin loads smart. It has to.
Okay well it that case I don't think it matters. If the script defines SMART and SMART is already defined in the include, I don't think it throws an error.

All in all, I think SMART is fine to be loaded since Reflection can't run without it, but I think SRL should be separate so users can have the choice between Refection and Color in certain scripts.

DeSnob

2011-09-29 16:24:44

Open Objects? I LOVE YOU. I LOVE YOU.

mormonman

2011-09-29 16:49:01

From: DeSnob
Open Objects? I LOVE YOU. I LOVE YOU.


It's not what your thinking. That is going to be in ref2.2, which is what this plugin was built for.

Edit: I think it is ready for public usage. No more changes to the top of scripts.

Wizzup?

2011-10-08 18:43:27

I've added it to the auto updaters. (Plugins update + SRL Reflection 2 merge new_plugin). Please double-check and let me know if it works.

Crazydictator

2011-10-08 20:27:12

Not sure if this is why many scripts are no longer working but I think it is…


I received this error shortly after updating:


Exception in Script: Plugin(LibReflection32) has not been found

Harry

2011-10-08 20:36:57

Do an update of your SRL and Reflection and restart Simba and it should work.

Crazydictator

2011-10-08 20:42:11

I've done all that, it's still giving errors. Here's some of the latest:

I updated reflection and it said no updates available, then it updated something below:
[Hint] (603:10): Variable 'Result' never used at line 602
[Hint] (761:7): Variable 'MYLOC' never used at line 760
Compiled succesfully in 983 ms.
SRL Compiled in 15 msec
SMART Initialized.
Loaded: Server 3, Members: False, Signed: True, Super Detail: False.
[Reflection] You're using outdated hooks (version 666.1); updating you to version 667.1!
[Reflection] If you manually fixed your hooks, please make sure hookrevision values are greater than or equal to the online hooks to prevent overwriting.
[Reflection] Updated you to 667.1; please restart your script!
Successfully executed.


I restarted the script, resulting in this[this error came up in 'Bank.simba' not in the script I was using]:

Error: Exception: Access violation at line 568

LINE 568: Name := R_TrimHTML(SmartGetFieldString(Item, hook_interface_ComponentName));


I'll keep testing and post anything that comes up.



UPDATE:

I deleted reflection and copied the older version of reflection into the includes folder. The script worked fine again.

Harry

2011-10-08 20:48:36

An access violation shouldn't be an issue (though it's bad to get). Rerun the script and it shouldn't happen again.

Edit: access violation was caused by a bad merge. Wait a little bit for Reflection to update again (was fixed on git, just takes up to an hour for Simba to automatically download it).

chitin

2011-10-08 21:20:46

From: Wizzup?
I've added it to the auto updaters. (Plugins update + SRL Reflection 2 merge new_plugin). Please double-check and let me know if it works.


got the auto update for both thanks:spot:

Wizzup?

2011-10-09 09:26:00

I am confused as to how it is supposed to work. Why is libsmart loaded too? (by Simba that is, {.loadlib smart})

Why does libsmart have to be loaded at all by Reflection? Can't it just use its own plugin? I think a few things are not in order yet. Perhaps a small file that loads the Reflection plugin before SRL is even included? Also, since Simba also loads libsmart it is not a wise idea to call UnloadLibrary(libsmart), I think.

Also, perhaps you could make the plugin export the functions with the Smart* prefix? That would make distinction easier. This way loading libsmart can override your previous exports, AFAIK. For example: LibReflection exports SmartGetX, then libsmart is loaded and exports SmartGetX. What function will the script use? I think the latter. It depends on what plugin is loaded first. Changing the names is a must unless we can figure a way how NOT to load the smart plugin from scripts as well. It's hard to debug when I'm not even sure what plugin is being called. What makes it even harder to debug is that whenever I'm using gdb to debug smart, it keeps throwing random SIGSEGV signals - stupid JNI/Java.


If I can't figure out the issue wrt (http://villavu.com/forum/showthread.php?p=834864#post834864), perhaps it would be an idea to revert this merge for a short while?

All in all, I'm a bit confused at the moment, but it'll be fixed shortly I guess.