Author |
Topic: "Number Too Big" error (Read 720 times) |
|
tsh73
Full Member
member is offline


Gender: 
Posts: 210
|
 |
Re: "Number Too Big" error
« Reply #4 on: Apr 13th, 2015, 9:32pm » |
|
wait - does LBB has non-blocking INPUT$(1)? does it documented somewhere? Code:timer 100, [back]
[back]
print time$("ms")
scan
i$=input$(1): if asc(i$)<>13 then goto [back]
timer 0
print "Enter pressed"
end
*falls off chair*
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: "Number Too Big" error
« Reply #5 on: Apr 13th, 2015, 9:54pm » |
|
on Apr 13th, 2015, 8:11pm, Monkfish wrote:| No, I am using LBB version 2.82 |
|
So please upgrade. I can only provide support for v3.00.
Quote:| Yes 175600 is the line number. Old habits die hard. |
|
So are you using GOTOs or GOSUBs to line numbers? Although that works in LBB it's not a feature that is extensively tested because it's rarely used (and it's slow compared with using labels).
Quote:| It's the only way I could think of to confirm I had the right line. |
|
If it said 'at line 823' that's the actual line in your source program where the error happened, so you need only page down and move the cursor (caret) until that number is displayed in the status bar. In v3.00 it's even easier: bring up the Goto Line dialog (e.g. Ctrl+G) and type in 823.
Quote:Here is the timer code: Code:timer 100, [cont]
[back]
i$=input$(1): if asc(i$)<>13 then goto [back]
timer 0: goto [Enter_Pressed] |
|
It's a bit unusual but I can't see any obvious reason why it wouldn't work.
Edit: Anatoly has rightly identified a potential problem with this code, so it ought to be changed to use INPUT rather than INPUT$(1).
Richard.
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: "Number Too Big" error
« Reply #6 on: Apr 13th, 2015, 10:46pm » |
|
on Apr 13th, 2015, 9:32pm, tsh73 wrote:| wait - does LBB has non-blocking INPUT$(1)? |
|
It works the same as the regular INPUT statement: it blocks but internally does a SCAN so can be interrupted by a TIMER or GUI event.
However in the case of INPUT$(1) that feature is really only intended to be used with a SUB handler. Using a label as the TIMER handler is risky because it may cause a jump out of the expression evaluator.
Maybe that is indeed the cause of the OP's problem. As he is trying to detect the Enter key being pressed a regular INPUT should work just as well, and is safer:
Code:timer 100, [cont]
[back]
input i$
timer 0: goto [Enter_Pressed]
[cont]
timer 0: goto [Continue] Richard.
|
|
Logged
|
|
|
|
Monkfish
Full Member
member is offline


Gender: 
Posts: 104
|
 |
Re: "Number Too Big" error
« Reply #7 on: Apr 14th, 2015, 9:51pm » |
|
Thanks for all your help guys. I am now using V3.00 and have done what you suggested. I haven't seen the error again, so cross fingers 
Richard, when you said that line numbers are slower what did you mean exactly? I thought line numbers were viewed by the compiler like labels... just that every line has a label. Will it actually make my program slower?
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: "Number Too Big" error
« Reply #8 on: Apr 14th, 2015, 10:45pm » |
|
on Apr 14th, 2015, 9:51pm, Monkfish wrote:| I thought line numbers were viewed by the compiler like labels... just that every line has a label. Will it actually make my program slower? |
|
It can, yes (in LBB; I can't speak for LB). It all depends on where the line you are jumping to is. If it's near the beginning of the program then using a line number may be no slower than a label (it may even be faster) but the further into the program the destination is, the slower using a line number will become. With a label the location of the destination makes little difference to the speed.
Richard.
|
|
Logged
|
|
|
|
Monkfish
Full Member
member is offline


Gender: 
Posts: 104
|
 |
Re: "Number Too Big" error
« Reply #9 on: Apr 15th, 2015, 07:58am » |
|
Oh, thanks Richard, I didn't know that. Clearly I need to go to programming Boot Camp!
|
|
Logged
|
|
|
|
|