SRL Archive - SRL Suggestions

GameTab 25 is not a valid tab number


Bixby Sayz

2011-04-13 22:55:28

Following the latest update a number of inventory routines (and others) now give the following warning if the bank screen is open:

** Warning in <SomeFunction>: GameTab 25 is not a valid tab number.**


In order to fix it this:
  GameTab(tab_Inv);
must be changed to this:
  if not BankScreen then
GameTab(tab_Inv);

The change must be made in the following places:

inventory.scar
- function GetInven (line 56)
- function GetInvItemBounds (line 178)
- function ExistsItem (line 199)
- function ExistsItemDTM (line 212)
- function InvMouse (line 242)
- function InvCount (line 301)
- function InvEmpty (line 316)
- function CountItems (line 343)
- function ClickAllItemsExcept (line 365) (not sure if this one needs it)
- function CountItemsBlackLine (line 592)
- function ClickAllItemsBlackLine (line 616)

firemaking.scar
- function WeHaveLogs (line 73)

ranging.scar
- function FindInvArrows (line 53)

runecrafting.scar
- function FindTalismanInInventory (line 118)

MSI also requires a number of similar changes.

Coh3n

2011-04-14 00:28:40

I posted this on another thread, why not try putting this in gameTab?

if (i = TAB_INV) then
if (bankScreen) then
exit;

Bixby Sayz

2011-04-14 08:12:47

That would work. Makes more sense than mine. Remind me not to post anything way late at night while I'm sleep deprived. Should have thought of that.

Regardless be nice to see one fix or another commited. Bit of a pain to have to reapply all your custom fixes every time SRL updates.

HarryJames

2011-04-14 08:14:19

A lot of them DO get commited, it just takes a bit of time to get it done. It's not hard to copy/paste a few lines of code either!

Bixby Sayz

2011-04-14 08:30:33

Sorry. Forgot how touchy everyone is when you suggest SRL is less than 100% perfect. My bad.

lordsaturn

2011-04-14 18:20:14

From: Bixby Sayz
Sorry. Forgot how touchy everyone is when you suggest SRL is less than 100% perfect. My bad.


It's ok, It's just a front to keep morale up when we know it sucks.

Coh3n

2011-04-14 19:21:56

The error plus your fix doesn't even make sense to me. That warning is thrown if the "Tab" parameter isn't in between the start and end gametab constants. If you're getting that message, you should get it all the time, no matter if the bank screen is open or not. Also, 25 is in range of the constants in my globals.scar, maybe check yours? Because by the looks of it, your constants are messed up for some reason.

Bixby Sayz

2011-04-14 20:38:42

From: Coh3n
If you're getting that message, you should get it all the time, no matter if the bank screen is open or not.


That's what I thought at first too, until I had a closer look at GameTab. That error message is in there twice.

The second is in the else clause for this statement:
if (TabExists(Tab)) then
{Whole lotta code in here}
end else
SRL_Warn('GameTab', 'GameTab ' + IntToStr(Tab) + ' is not a valid tab number.', warn_Notice);
It is way down at the end of the function and easy to overlook. Following your suggestion I now add this to GameTab everytime SRL is updated:
if (Tab = TAB_INV) then
if (bankScreen) then
exit;
And the warning has gone away.

Coh3n

2011-04-15 10:59:45

Ah yes, I see. I still don't see the problem, all it's doing is writln'ing a message. Does it actually mess anything up? Or is this just because the message is annoying?

E: That warning message should probably be "Gametab 25 currently doesn't exist" as that would make more sense.

Bixby Sayz

2011-04-15 20:49:30

It can get pretty "spammy" (is that even a word?) in the message log is all.

While I don't pretend to have the knowledge (or time) to fix/update some of the bigger things, I try to chip away at the smaller things to improve the quality of the includes, in order to give back a little.

The feedback on this particular issue seems to be of the consensus "who cares it's not hurting anything", so I would suggest just leaving it like it is.

Coh3n

2011-04-15 21:37:49

From: Bixby Sayz
It can get pretty "spammy" (is that even a word?) in the message log is all.

While I don't pretend to have the knowledge (or time) to fix/update some of the bigger things, I try to chip away at the smaller things to improve the quality of the includes, in order to give back a little.

The feedback on this particular issue seems to be of the consensus "who cares it's not hurting anything", so I would suggest just leaving it like it is.

I agree that it would be annoying, but I'm wondering why I don't get the message if everyone else is.

Bixby Sayz

2011-04-15 22:20:51

From: Coh3n
I agree that it would be annoying, but I'm wondering why I don't get the message if everyone else is.


what is WarnSensitivity set to in your script(s)? By default SetupSRL sets it to warn_Warning.

In order to actually see warnings you would have to set it to warn_Notice or warn_Debug.

Coh3n

2011-04-17 20:53:38

From: Bixby Sayz
what is WarnSensitivity set to in your script(s)? By default SetupSRL sets it to warn_Warning.

In order to actually see warnings you would have to set it to warn_Notice or warn_Debug.

You mentioned something about MSI? MSI is set to whatever SRL is as far as I know, so you shouldn't get the warning with MSI if what you say is true.

Bixby Sayz

2011-04-17 21:42:00

From: Coh3n
You mentioned something about MSI? MSI is set to whatever SRL is as far as I know, so you shouldn't get the warning with MSI if what you say is true.


Now I am confused. I never mentioned MSI anywhere.

I so regret starting this topic. This issue only occurs when you change the WarnSensitivity and it is obvious that nobody else really gives a damn, so can we just let this die?

Coh3n

2011-04-17 23:15:16

From: Bixby Sayz
Now I am confused. I never mentioned MSI anywhere.

I so regret starting this topic. This issue only occurs when you change the WarnSensitivity and it is obvious that nobody else really gives a damn, so can we just let this die?

You said in the first post that MSI also requires a lot of changes.

And I'm not mad or annoyed if you got that impression, I was just trying to get things straight. You just seem bitter about it, that's all.

Markus

2011-04-18 04:11:04

Cohen, those warnings are there with a reason. They warn for ugly code. The only reason warn sensitivity is a bit higher default is to stop noobs from complaining, so the real scriptz0rz can fix it. IMO, every scripter should set his warning level at warn_Debug, but hardly any of them do it (OP being a good exception).
If MSI triggers those warning, then MSI needs to be fixed, yes. OP did a good job at pointing that out.
(Oh, and I agree the warning message is a bit ambigious when the tab currently does not exist).

@Bixby: send me a pull request with all your fixes, I'll check them and push them upstream.

Bixby Sayz

2011-04-18 08:54:41

From: Markus
IMO, every scripter should set his warning level at warn_Debug,


That wouldn't help as much as you think, as there is a bug in srl_Warn.
if (wVersion > WarnSensitivity) then
should be
if (wVersion >= WarnSensitivity) then
warn_Debug > warn_Debug never equals true, so debug messages never get through.

Another one of my half dozen or so edits I make the SRL includes everytime SRL is updated. Getting to the point I need to write a script just to make the changes for me.

Markus

2011-04-18 09:54:32

Use diff/patch to automate that process, and pleeeaaasee send me that patch then :)

Coh3n

2011-04-18 10:18:47

From: Markus
Cohen, those warnings are there with a reason. They warn for ugly code. The only reason warn sensitivity is a bit higher default is to stop noobs from complaining, so the real scriptz0rz can fix it. IMO, every scripter should set his warning level at warn_Debug, but hardly any of them do it (OP being a good exception).
If MSI triggers those warning, then MSI needs to be fixed, yes. OP did a good job at pointing that out.
(Oh, and I agree the warning message is a bit ambigious when the tab currently does not exist).

@Bixby: send me a pull request with all your fixes, I'll check them and push them upstream.

I agree. I'm confused, though. Did I say something wrong? I was just wondering why he was getting the warnings and I wasn't. I got out of the first post that there was an error, but everything was working for me so I was trying to get things straight.

From: Bixby Sayz
That wouldn't help as much as you think, as there is a bug in srl_Warn.
if (wVersion > WarnSensitivity) then
should be
if (wVersion >= WarnSensitivity) then
warn_Debug > warn_Debug never equals true, so debug messages never get through.

Another one of my half dozen or so edits I make the SRL includes everytime SRL is updated. Getting to the point I need to write a script just to make the changes for me.

If they're changes that should be committed then yeah, send a pull request or make a patch. I'm confused at the bitterness of this thread. :confused:

Bixby Sayz

2011-04-19 10:35:24

From: Coh3n
You mentioned something about MSI? MSI is set to whatever SRL is as far as I know, so you shouldn't get the warning with MSI if what you say is true.


I stand corrected. I did in fact mention MSI, but only because I was tackling the issue in a dumbass way and changing every place that references GameTab rather than just patch GameTab itself as you suggested. Do not code late at night! 20 years later I still haven't learned that lesson.

From: Coh3n
You just seem bitter about it, that's all.


No not bitter. I simply get the impression this is a non issue as the consensus seems to be this is no big deal. In which case there is no point making the change.

From: Coh3n
If they're changes that should be committed then yeah, send a pull request or make a patch. I'm confused at the bitterness of this thread. :confused:


Meh, I give up. Can't find the repo for SRL searching this site. Found MSI, Refelection, and SRL 5 on github, but not srl. Must be super secret classified. :)

If I ever figure it out I'll push / pull? my changes to srl_Warn.

Coh3n

2011-04-19 12:41:53

I can't seem to find SRL 4 either. :o Maybe it's a git repository hosted by Villavu, but I still can't find it. Guess a path would be the easiest way.

Markus

2011-04-19 12:45:27

From: Bixby Sayz
Meh, I give up. Can't find the repo for SRL searching this site. Found MSI, Refelection, and SRL 5 on github, but not srl. Must be super secret classified. :)

If I ever figure it out I'll push / pull? my changes to srl_Warn.


SRL 4 is still at SVN atm, Wizzup generates snapshots for it.

Bixby Sayz

2011-04-19 21:31:32

From: Markus
SRL 4 is still at SVN atm, Wizzup generates snapshots for it.


In that case, may I simply post my suggested change for srl_Warn here?
procedure srl_Warn(ProcName, ErrorMessage: String; wVersion: Integer);
begin
if (wVersion >= WarnSensitivity) then
if (wVersion <> warn_Debug) then
WriteLn('** Warning in ' + ProcName + ': ' + ErrorMessage + '**')
else
WriteLn('Debugging ' + ProcName + ': ' + ErrorMessage);
if wVersion = warn_Terminate then
TerminateScript;
end;
2 Changes: Fix first equality check so warn_Debug does actually get shown and use a constant for warn_Terminate.

Edit: FFS. Hidden in plain site. Bonus points if you can find srl from the srl-opendev files this links to.

Coh3n

2011-04-19 23:12:25

Committed, and that is the SVN repository. I thought there was a git one as well for whatever reason.

Bixby Sayz

2011-04-20 11:55:23

From: Coh3n
Committed, and that is the SVN repository. I thought there was a git one as well for whatever reason.


So did I, but I'll be damned if I can find it. Don't think it has been moved over yet.

Coh3n

2011-04-20 11:57:38

From: Bixby Sayz
So did I, but I'll be damned if I can find it. Don't think it has been moved over yet.

Aha! Found it.

http://git.villavu.com/?p=srl-opendev/.git;a=summary

Since the SVN is still used, it's just easier to post rather than a pull request as I'm not sure how different git.villavu is from github.