SRL Archive - RS3 Help

Simba is not including the file or something?


rj

2014-01-03 00:06:44

Why am I getting a unknown identifier error?



How is it not finding init?

Kasi

2014-01-03 03:01:18

Edit: nvm, didnt see they were different variable types.

where is your inventory var declared?

bg5

2014-01-03 07:06:45

what about screen.init() ?

Lape compiler sometimes prints number of line below actual error.

rj

2014-01-03 10:41:14

@Kasi;

the inventory var is declined in inventory.simba, and it's not finding it because I tired to do writeln(inventory.slots) and I got unknown identifier

@bgs5;

I changed the name of screen to init to mainscreen.init (because mainscreen was the name of the var pointing to screen, mistake on my part) and it the error still showed up on the line below.


I also changed it up inventory.startup or mainscreen.startup with the same error so I'm pretty sure it's not including the file or something

Brandon

2014-01-03 12:35:03

From: Officer Barbrady
@Kasi;

the inventory var is declined in inventory.simba, and it's not finding it because I tired to do writeln(inventory.slots) and I got unknown identifier

@bgs5;

I changed the name of screen to init to mainscreen.init (because mainscreen was the name of the var pointing to screen, mistake on my part) and it the error still showed up on the line below.


I also changed it up inventory.startup or mainscreen.startup with the same error so I'm pretty sure it's not including the file or something


You're going to have to show more code that a screenshot. I doubt anyone at all can tell what is going on based off just that snippet. We cannot see the declaration of any variables.

rj

2014-01-03 12:44:07

From: Brandon
You're going to have to show more code that a screenshot. I doubt anyone at all can tell what is going on based off just that snippet. We cannot see the declaration of any variables.


https://github.com/officerBarbrady/srlRSPS

{$I RSPS/srlRSPS.Simba}

var
myServer:_rsps_server;

begin
myServer.init(720, 'CloudIn');
writeln(myServer.getupText);
writeln(inventory.count);
end.

that is the test script I'm trying to run


the var mainscreen is declared in mainscreen.simba
inventory is declared in inventory.simba

Kasi

2014-01-04 14:59:20

@Officer Barbrady;

It is finding it, its finding two different things called inventory. No idea what two things, but my guess is something to do with the file name too, Couldn't be bothered searching all your include for another variable called inventory (shouldn't be as it would give of Duplicate identifier error). Quick fix = rename line 16 in inventory.simba to something else e.g (inventory : rsps_inventory; = inventory1 : rsps_inventory;)

Edit: found it. Line 15 of RSPS/core/globals.simba.

rj

2014-01-04 15:03:44

From: Kasi
@Officer Barbrady;

It is finding it, its finding two different things called inventory. No idea what two things, but my guess is something to do with the file name too, Couldn't be bothered searching all your include for another variable called inventory (shouldn't be as it would give of Duplicate identifier error). Quick fix = rename line 16 in inventory.simba to something else e.g (inventory : rsps_inventory; = inventory1 : rsps_inventory;)


Thanks, I found it, it was under type _rsps_server


Now I'm getting access violation -.-
Exception in Script: Runtime error: "Access violation"

going to be hard to find

Kasi

2014-01-04 15:09:00

From: Officer Barbrady

Now I'm getting access violation -.-
Exception in Script: Runtime error: "Access violation"

going to be hard to find


Learn Compiler Directives.
Parenthesis
From: nielsie95

Compiler directives
  • a, align - To determine how records are aligned
Used like {$Align 4} to align record fields on 4 bytes (this means a record with only a byte field is still 4 bytes long). This is added for compatibility with external records.
  • c, assertions - Compile assertions
  • b, booleval - Short circuit boolean evaluation
  • m, memoryinit - Initialize all variables to zero
  • x, extendedsyntax - Allow statements outside of regular blocks
  • f, autoinvoke - Allow invocation of methods without explicit parenthesis
  • s, scopedenums - Do not add enums to the scope (access through enum.field)

Used like {$B+}, {$B-} or {$B ON}, {$B OFF}.

rj

2014-01-04 15:18:32

From: Kasi
Learn Compiler Directives.
Parenthesis


Found the source of the access violation..
mainscreen started!
starting!
Outline set!
Starting setup procedure
Setting length
Exploded box
Exception in Script: Runtime error: "Access violation"

with self do
begin
Writeln('starting!');
outline := 131072;
Writeln('Outline set!');
setUp(IntToBox(568, 213, 717, 458));
Writeln('Box array set!');
bounds := intToBox(568, 213, 717, 458);
Writeln('Bounds set!');
name := '724 inventory';
end;


This line

      setUp(IntToBox(568, 213, 717, 458));


It seems to do this procedure

procedure rsps_inventory.setUp(b:tbox);
begin
Writeln('Starting setup procedure');
setLength(self.slots, 28);
Writeln('Setting length');
self.slots := self.explodeBox(b, 7, 4);
Writeln('Exploded box');
end;

But cannot reach this part


bounds := intToBox(568, 213, 717, 458);

Kasi

2014-01-04 15:47:48

From: Officer Barbrady

But cannot reach this part
bounds := intToBox(568, 213, 717, 458);


is "bounds" a member of rsps_inventory.

Edit: how did you get your test script to compile? i'm debugging blind here. don't have any RSPS to test your include on. AFAIK your test script should of error'd out on writeln(myServer.getupText);

rj

2014-01-04 16:25:19

From: Kasi
is "bounds" a member of rsps_inventory.

Edit: how did you get your test script to compile? i'm debugging blind here. don't have any RSPS to test your include on. AFAIK your test script should of error'd out on writeln(myServer.getupText);


i'm not testing it on a rsps or something im just hitting run

bounds of apart of


type
rsps_interface = record
name:string;
close:TPoint;
bounds:TBox;
end;

updated the include on my github https://github.com/officerBarbrady/srlRSPS

{$I RSPS/srlRSPS.Simba}

var
myServer:_rsps_server;

begin
myServer.init(720, 'CloudIn');
writeln(myServer.getupText);
writeln(inventory.count);
end.

Kasi

2014-01-05 09:57:23

@Officer Barbrady;

Works fine for me.


{$I RSPS/srlRSPS.Simba}

var
myServer:_rsps_server;

begin
myServer.init(720, 'CloudIn');
writeln(myServer.getupText());
writeln(inventory.count);
writeln(inventory.bounds);
end.


Compiled successfully in 327 ms.
mainscreen started!
starting!
Outline set!
Starting setup procedure
Setting length
Exploded box
Box array set!
Bounds set!
Inventory started!
. .. :e - -s--s-
0
{X1 = 568, Y1 = 213, X2 = 717, Y2 = 458}
Successfully executed.

rj

2014-01-05 11:15:21

From: Kasi
@Officer Barbrady;

Works fine for me.


{$I RSPS/srlRSPS.Simba}

var
myServer:_rsps_server;

begin
myServer.init(720, 'CloudIn');
writeln(myServer.getupText());
writeln(inventory.count);
writeln(inventory.bounds);
end.


Compiled successfully in 327 ms.
mainscreen started!
starting!
Outline set!
Starting setup procedure
Setting length
Exploded box
Box array set!
Bounds set!
Inventory started!
. .. :e - -s--s-
0
{X1 = 568, Y1 = 213, X2 = 717, Y2 = 458}
Successfully executed.


Ahh I see you did the uptext differently -.-

thanks guys

Kasi

2014-01-05 14:59:21

From: Officer Barbrady
Ahh I see you did the uptext differently -.-


Finally Understood the compiler directives post then? Look at the white text.