SRL Archive - SRL Bugs

GetBankItemAmount(const Row, Col: Integer): Integer;


smurg

2012-05-12 11:31:34

The Rows and Columns are switched.

Say I have a bank setup with items numbering:

7 1 3 5 6
4 5 2 8 9

GetBankItemAmount(1, 0); would return 1.
GetBankItemAmount(0, 1); would return 4.

This is backwards. Of course it employs other functions too so I'm not sure how far down the line they're backwards.

Thanks

Le Jingle

2012-05-12 17:40:32

Support, from the looks of it, I think it's just the (row, col) needs to be switched around to (col, row)? [As far back as needed to edit]

function BankIndexToMSPoint(Index: Integer): TPoint;
begin
Index := Index - 1;
Result := Point(38 + (Index mod 10) * 44, 90 + Floor(Index div 10) * 45);
end;


function BankIndexToMSBox(Index: Integer): TBox;
var
P: TPoint;
begin
P := BankIndexToMSPoint(Index);
Result.X1 := P.X;
Result.Y1 := P.Y;
Result.X2 := Result.X1 + 31;
Result.Y2 := Result.Y1 + 32;
end;


function GetBankIndexItemAmount(const Index: Integer): Integer;
begin
Result := getAmountBox(BankIndexToMSBox(Index));
end;

Kyle Undefined

2012-05-19 02:35:53

Could you go into Bank.simba and change BankPointToBankIndex to


function BankPointToBankIndex(P: TPoint): Integer;
begin
Result := P.X * 10 + P.Y + 1;
end;

It's printing the correct values now, but I don't want to commit this yet. I don't know if it was really that easy of a fix.

Le Jingle

2012-05-19 04:45:17

With that simple change, I recieved all correct amounts;

Program New;
{$DEFINE SRL5}
{$i srl/srl.simba}
//GetBankItemAmount(const Row, Col: Integer): Integer;
Begin
SetupSRL;
WriteLn(GetBankItemAmount(0,0));
WriteLn(GetBankItemAmount(0,1));
WriteLn(GetBankItemAmount(1,0));
WriteLn(GetBankItemAmount(1,1));
End.

Gave Me:

10
5
100
15
(all of which were the correct slots, and number amounts)

Narcle

2012-05-19 22:39:14

From: irc
(22:36:33) Narcle: oh that… yeah i recall it
(22:36:33) Ninja`: Which was backwards and gave the wrong slot
(22:36:49) Narcle: someone did it weird long time ago
(22:36:56) Narcle: you have to read the text that is used in the function
(22:37:04) Narcle: GetBankItemAmount(const Row, Col: Integer)
(22:37:08) Narcle: Row, Col
(22:37:13) Narcle: … yeah idk why it was done that way
(22:37:19) Narcle: but it would break way to much shit atm

^^^ would unfortunately break way too much atm to change, not to mention all scripts using these.

Kyle Undefined

2012-05-19 22:40:29

What Narcle said, and you'd have to manually update the code on your side if you want it to work correctly, for now.

smurg

2012-05-20 00:22:12

But couldn't you just flip-flop the description and variables in use so that they are the correct labels at least?

Narcle

2012-05-20 13:14:25

From: smurg
But couldn't you just flip-flop the description and variables in use so that they are the correct labels at least?


GetBankItemAmount(const Row, Col: Integer): Integer;

Row ===============

Col (column)
||
||
||
||
||
||

"They are correct." Pain in the ass isn't it? I know I looked into it a while ago and was like /facepalm. I wanted to change it then but it would break to much.

smurg

2012-05-20 18:33:02

From: Narcle
GetBankItemAmount(const Row, Col: Integer): Integer;

Row ===============

Col (column)
||
||
||
||
||
||

"They are correct." Pain in the ass isn't it? I know I looked into it a while ago and was like /facepalm. I wanted to change it then but it would break to much.


Rows are horizontal and columns are vertical.

Rows change values vertically and columns change values horizontally.

(Row, Column) would go like this:


(0, 0)(0, 1)(0, 2)(0, 3)(0, 4)(0, 5)
(1, 0)(1, 1)(1, 2)(1, 3)(1, 4)(1, 5)
(2, 0)(2, 1)(2, 2)(2, 3)(2, 4)(2, 5)
(3, 0)(3, 1)(3, 2)(3, 3)(3, 4)(3, 5)

Narcle

2012-05-20 19:15:59

From: smurg
Rows are horizontal and columns are vertical.

Rows change values vertically and columns change values horizontally.



Uh yea… Think about it again.

Rows:
0 ——–
1 ——–
2 ——–
3 ——–
4 ——–

Columns
0 1 2 3 4 5
| | | | | |
| | | | | |

smurg

2012-05-21 12:18:10

From: Narcle
Uh yea… Think about it again.

Rows:
0 ——–
1 ——–
2 ——–
3 ——–
4 ——–

Columns
0 1 2 3 4 5
| | | | | |
| | | | | |


Yes, that's what i explained in my OP and in the last post.

The function is currently backwards.

smurg

2012-06-03 01:14:03

Can you test the function? You'll see what I mean.

Kyle Undefined

2012-06-03 04:12:00

I know what you mean, and I've tested it. I even have a fix for it, but it will break way too much stuff.

smurg

2012-06-11 01:13:15

I mean just now, my suggestion would be to change the description around, like the variables Row and Col in the parameters.

Syntax

2012-06-12 04:56:52

Did this get fixed? Still using my own method but may use this soon.

riwu

2012-06-12 05:35:03

From: Blakebn2011
Did this get fixed? Still using my own method but may use this soon.

There is nothing wrong with the function, except that the labels are cognitively wrong. Just swap the parameter and it'd work perfectly.

Sirenia

2012-06-12 06:34:28

I got problems with DepositAll, it doesnt work for me and I did this simple line
if InvEmpty then Writeln('yes');
and its saying yes all the time so simba doesnt know my inv have items in it :/