30 April 2009, 02:14 | #1 |
A1200 040 SAM440EP 667
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
|
BlitzBasic problem
Hello there,
I´m writing a little program to calculate resistor values in AmiBlitz3 but when I run the following program to test, it gives me the error Label reference out of context at program line in bold. If used Goto _color instead Gosub _color, same error happens Can someone explain me why this error and how to jump to the subroutine?? Thanks in advance WBStartup WbToScreen 0 Use Screen 0 Statement Requester{} GTString 0,1,24,17,60,14,"",0,8:GTInteger 0,4,140,51,70,14,"",0,0 GTString 0,2,24,34,60,14,"",0,8 GTString 0,3,24,51,60,14,"",0,8 GTCycle 0,5,110,7,140,14,"",0,"Cores->Valores|Valores->Cores|" Window 0,100,100,280,100,$08 | $02,"Resistor Colors",1,2,0 AttachGTList 0,0 WLocate 37,04:Print "Cores":WLocate 130,37:Print "Valor em ohms" WLocate 4,17:Print "1a":WLocate 4,34:Print "2a":WLocate 4,51:Print "3a" End Statement Statement Togle{} Repeat ev.l=WaitEvent If ev=$40 AND GadgetHit=1 OR GadgetHit=2 OR GadgetHit=3 col1$=GTGetString(0,1) : col2$=GTGetString(0,2):col3$=GTGetString(0,3) Gosub _color EndIf If ev=$40 AND GadgetHit=4 Gosub _valor EndIf Until ev=$200 End Statement ._color WLocate 4,17:Print col1$:WLocate 4,34:Print col2$:WLocate 4,51:Print col3$ Return ._valor Repeat ev.l=WaitEvent If ev=$40 v=GTGetInteger(0,4) EndIf Until ev=$200 Return Statement Main{} Requester{} Togle{} MouseWait CloseWindow 0 Free GadgetList 0 End Statement Main{} |
30 April 2009, 06:20 | #2 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
I know nothing about basic (well apart from the fact that I hate it) but you could try moving that subroutine above the calling block.
|
30 April 2009, 09:02 | #3 |
Registered User
Join Date: Sep 2008
Location: Gainesville U.S.A.
Posts: 771
|
I don't keep up with the new-fangled BASIC's either but make these changes and at least you'll not be looking at the SAME error.
Until ev=$200 goto jail ._color WLocate 4,17:Print col1$:WLocate 4,34:Print col2$:WLocate 4,51:Print col3$ Return ._valor Repeat ev.l=WaitEvent If ev=$40 v=GTGetInteger(0,4) EndIf Until ev=$200 Return jail: End Statement Statement Main{} |
30 April 2009, 09:11 | #4 | |
HOL/FTP busy bee
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,525
|
Found on the net :
Quote:
|
|
30 April 2009, 18:18 | #5 |
A1200 040 SAM440EP 667
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
|
Thanks for the help guys
@TheCyberDruid With your help I could solve the problem "there should be no code visible from the main program when inside a statement or function" Thanks dude |
01 May 2009, 10:58 | #6 |
HOL/FTP busy bee
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,525
|
You are welcome Alfa Good to hear it worked this way
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
REQ: Amiga Format - BlitzBasic Tutorials | AlfaRomeo | AMR suggestions and feedback | 23 | 20 February 2012 18:25 |
From the makers of BlitzBasic: Monkey... now with OS3.x and AROS support | HenryCase | News | 13 | 14 January 2012 05:33 |
Anyone still writing games with BlitzBasic ?? | Joe Maroni | Coders. General | 0 | 17 November 2008 22:26 |
BlitzBasic (PC) | LaundroMat | Coders. General | 9 | 23 June 2003 09:14 |
BlitzBasic - Is now open source | Djay | Amiga scene | 2 | 08 February 2003 01:09 |
|
|