News:

*NEW* Current Version on STEAM16.793

Webchat:
Visit the chat



DIM

Previous topic - Next topic

roberto

DIM
Code (glbasic) Select

// Project: PioggiaDiMario
// Start: Monday, December 05, 2016
// IDE Version: 14.001

// FREE-VERSION:
// Need Premium for Features:
// 3D Graphics
// Network Commands
// INLINE C/C+++ code

LOCAL a$
GLOBAL b$, n1, n2, n3, postodata
//GLOBAL barig$, cagliarig$, firenzeg$, genovag$, milanog$, napolig$, palermog$, romag$, torinog$, veneziag$
//DIM   pos[6]
//DIM   riga$[811]
DIM   postodata[9]
postodata[0]=0
postodata[1] = -30
postodata[2] = -29
postodata[3] = 1
postodata[4] = 31
postodata[5] = 30
postodata[6] = 29
postodata[7] = -1
postodata[8] = -31

n1 = 32
n2 = 90
n3 = 3
//La formula per trovare la posizione è n1+n2*x+3(y-z), 32+90*5+3(54-51)=491
//dove x è la parte intera del numero diviso 10,
//y è il numero e z è x per 10 +1

menu (a$)

SHOWSCREEN
MOUSEWAIT

//MENU
FUNCTION menu: a$
PRINT "MENU",110,10
PRINT "1. INSERIMENTO NUMERI USCITI", 10,20
PRINT "2. SCELTA RUOTA DA STAMPARE", 10,30
PRINT "3. STAMPA ELENCO RUOTE GIOCABILI IN ORDINE DA 10 A MENO NUMERI", 10,40
PRINT "4. SELEZIONA RUOTA PER STAMPA NUMERI GIOCABILI", 10,50
PRINT "5. VINCITE O PERDITE COMPLESSIVE PUNTANDO 1 EURO", 10,60
INPUT a$, 10,70
IF a$ = 1 THEN GOSUB ruote
ENDFUNCTION

SUB ruote:
PRINT "1. BARI",10,20; PRINT "2. CAGLIARI",10,30; PRINT "3. FIRENZE",10,40; PRINT "4. GENOVA",10,50; PRINT "5. MILANO",10,60; PRINT "6. NAPOLI",10,70; PRINT "7. PALERMO",10,80; PRINT "8. ROMA",10,90; PRINT "9. TORINO",10,100; PRINT "10. VENEZIA",10,110
INPUT  b$, 10,120
//IF  b$=1 THEN GOSUB bari
ENDSUB



*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.10.037 SN:ea8f9b97 - 2D, WIN32
Wordcount:37 commands
compiling:
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:77: error: no matching function for call to `DIM(DGInt&, int)'
Q:/Compiler/platform/Include/glb.h:916: note: candidates are: void __GLBASIC__::DIM(__GLBASIC__::DGIntArray&, DGNat, DGNat, DGNat, DGNat)
Q:/Compiler/platform/Include/glb.h:917: note:                 void __GLBASIC__::DIM(__GLBASIC__::DGNatArray&, DGNat, DGNat, DGNat, DGNat)
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:81: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:85: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:89: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:93: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:97: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:101: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:105: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:109: error: `__GLBASIC__::postodata' cannot be used as a function
C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:113: error: `__GLBASIC__::postodata' cannot be used as a function


why? :'( :'(

Qedo

GLOBAL b$, n1, n2, n3, postodata[]


Ciao
Qedo

Moru

Hello!

This is due to setting up postodata as a variable. You need to set it up as an array. Yes, the error message could be more helpful :-) I have been banging my head against the wall a number of times because of this little thing until I finaly figured it out.

The line:
GLOBAL b$, n1, n2, n3, postodata

Needs to be changed to:
GLOBAL b$, n1, n2, n3, postodata[]

This prepares GLBasic for treating postodata[] as an array.

Schranz0r

Qedo and Moru got it!
Thats your problem.
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

spacefractal

This is just a code bug.

But in the end, the glbasic parser should catch this kind of error in runtime in the ide, when a array on a DIM is not found?

Can been quite annoying with this kind of bugs and confucsion.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Schranz0r

the debug says all you need:

no matching function for call to `DIM(DGInt&, int)'

Trying to Dim an Int is a bad idea :D
Should be DGIntArray.
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

UBERmonkeybot

err that's ok then  ;)