SRL Archive - Reflection Tutorials

[How-to] Using Reflection In Your Script


Drakan

2010-06-03 11:52:50

Pictures and greater description will be added when I get home from school. I'm writing this blindly at school :P

Welcome to my second tutorial in the Reflection tutorial series! In this tutorial I will teach you how to add reflection to your script.

Prerequisites
In order to be able to use reflection in your script, you have to have it first ;) Make sure you have simba and reflection installed!

Adding the Includes
To use reflection, you must include it, as well as SRL.

{$DEFINE SMARt}
{$i srl\srl.scar}
{$i reflection\reflection.simba}

This will start smart, include srl, and include reflection.

Adding SMART Constants
Adding the constants is important, because if you have SMART load a random world, everytime you go to test your script SMART will restart. To avoid this, just add these constants. You can change their values as needed.

program ReflectionScript;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
const

{---SMART Setup Constants---}
WORLD = 32;
MEMBERS = false;
SIGNED = true;
{---------------------------}

begin
end.

Setting up Reflection and SRL
Now we need to call our setup procedures.

begin
Smart_Members := MEMBERS;
Smart_Server := WORLD;
Smart_Signed := SIGNED;

SetupSRL;
SetupReflection(true);
end.

Remember, it is important to declare those Smart constants BEFORE you SetupSRL.

The Reflection Template: http://code.google.com/p/simbareflection/source/browse/trunk/Tools/Template.Simba

i luffs yeww

2010-06-04 02:00:33

Why SetupReflection(True);? :o

Sir R. M8gic1an

2010-06-04 13:49:35

From: i luffs yeww
Why SetupReflection(True);? :o


If I'm not mistaken, 'true' will terminate the script if the hooks are outdated.

Looking good.

~RM

Drakan

2010-06-04 15:59:17

From: Rasta Magician
If I'm not mistaken, 'true' will terminate the script if the hooks are outdated.

Looking good.

~RM


Yup, thats it!

Coh3n

2010-06-10 13:00:36

You don't need to have {$DEFINE SMART}, it's already in Reflection.simba. Also, it's SetupReflectionEx right now, I'm assuming there's not suppose to be Ex.

Drakan

2010-06-10 14:37:39

From: Coh3n
You don't need to have {$DEFINE SMART}, it's already in Reflection.simba. Also, it's SetupReflectionEx right now, I'm assuming there's not suppose to be Ex.


Yah things are changing, when I wrote this it wasnt in the include. Also, I think i changed it from Ex to just SetupReflection, yes.

EDIT: I believe you will still need to define smart, because smart setup is called in SRL, and if you let reflection define smart, then smart will be defined AFTER srl is setup. Reflection MUST come after SRL. Correct me if I'm wrong.

Coh3n

2010-06-10 15:03:56

From: drags111
Yah things are changing, when I wrote this it wasnt in the include. Also, I think i changed it from Ex to just SetupReflection, yes.

EDIT: I believe you will still need to define smart, because smart setup is called in SRL, and if you let reflection define smart, then smart will be defined AFTER srl is setup. Reflection MUST come after SRL. Correct me if I'm wrong.

I just downloaded reflection and it's SetupReflectionEx. Also, I can't get it to compile. I keep getting:

Unknown identifier 'SmartGetFieldArraySize' at line 549
Compiling failed.
Line 549 is just a row of '*'. Yes I've moved the SMART plugin.

And yes, SRL does {$DEFINE SMART}, but then reflection does it also so it is defined after SetupSRL is called.

Shady?

2010-06-10 16:04:16

From: Coh3n
I just downloaded reflection and it's SetupReflectionEx. Also, I can't get it to compile. I keep getting:

Unknown identifier 'SmartGetFieldArraySize' at line 549
Compiling failed.
Line 549 is just a row of '*'. Yes I've moved the SMART plugin.

And yes, SRL does {$DEFINE SMART}, but then reflection does it also so it is defined after SetupSRL is called.


I also get this :/

Coh3n

2010-06-10 16:18:04

Move libsmart.dll to you plugins folder, then restart Simba. I didn't restart Simba. :duh:

Shady?

2010-06-10 20:08:05

From: Coh3n
Move libsmart.dll to you plugins folder, then restart Simba. I didn't restart Simba. :duh:


I still get the same -.- I'll delete the srl folder and try again

Nava2

2010-06-10 20:10:01

From: Coh3n
Move libsmart.dll to you plugins folder, then restart Simba. I didn't restart Simba. :duh:


Silly billys.

Also, Drags is correct, you *must* include SRL before reflection.

Scaper

2010-06-12 15:16:09

I am trying to set it up but this is what I am getting


please help asap

Runescapian321

2010-06-12 15:22:46

From: Scaper
I am trying to set it up but this is what I am getting


please help asap


Have you installed reflection and is Reflection.simba in Includes > Reflection?

Scaper

2010-06-12 15:28:10

yes I have installed refecltion to the directory

C:\Simba\Includes\SRL\SRL

made a folder named 'refelction' moved plugins etc etc, but when i goto compile

Exception in Script: Unable to find file 'reflection\reflection.simba' used from ''

i luffs yeww

2010-06-12 15:30:10

^ "Reflection.simba in Includes > Reflection"

You put it in the wrong place.

It's in Includes/, not Includes/SRL/SRL/.

BraK

2010-06-21 09:02:00

i'm also getting this error

[Error] C:\Users\Public\Simba\Includes\reflection\./Core/Core.simba(567:11): Unknown identifier 'SmartGetFieldArraySize' at line 566

I have already move the .dll to the plugin's folder and restarted Simba


{$i SRL/SRL/misc/SMART.scar}
{$i SRL/SRL.scar}
{$i reflection\reflection.simba}

const // Smart const
Smart_Server := 99;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False

procedure Setup;
Begin
setupsrl;
setupreflectionex(true); //used just ex and also no ex
Declareplayers;
end;

ZephyrsFury

2010-06-21 09:06:52

From: BraK
i'm also getting this error

[Error] C:\Users\Public\Simba\Includes\reflection\./Core/Core.simba(567:11): Unknown identifier 'SmartGetFieldArraySize' at line 566

I have already move the .dll to the plugin's folder and restarted Simba


{$i SRL/SRL/misc/SMART.scar}
{$i SRL/SRL.scar}
{$i reflection\reflection.simba}

const // Smart const
Smart_Server := 99;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False

procedure Setup;
Begin
setupsrl;
setupreflectionex(true); //used just ex and also no ex
Declareplayers;
end;


You need to move the libsmart.dll file from Reflection/Place in plugins folder to your Simba plugins folder. Is there a reason why this version of SMART can't be added to simba's official plugins?

BraK

2010-06-21 09:34:48

From: ZephyrsFury
You need to move the libsmart.dll file from Reflection/Place in plugins folder to your Simba plugins folder. Is there a reason why this version of SMART can't be added to simba's official plugins?


it's already been moved there.

i got it working it was setupreflectionex(true); for some reason was working correctly earlier.

ZephyrsFury

2010-06-21 09:52:19

Reflection has the newer version. Also delete the Embedded Smart.dll file, that could cause problems.