Compilerproblem???

Previous topic - Next topic

WPShadow

_______________________________________
*** Configuration: WIN32 ***
precompiling...

GPC - GLBasic Precompiler V.2005.23 - 3D(1), NET(1)
compiling...
C:\Programme\GLBasic\Projects\INI\INI.gbas (4471 bytes)
Wordcount:110 commands

compile+link...
C:\Programme\GLBasic\Compiler\platform\gpc_temp.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Programme\GLBasic\Compiler\platform\gpc_temp.cpp:15: `class GLBASIC::CGStr' used where a floating point value was expected
C:\Programme\GLBasic\Compiler\platform\gpc_temp.cpp:15: aggregate value used where a float was expected
C:\Programme\GLBasic\Compiler\platform\gpc_temp.cpp:19: `class GLBASIC::CGStr' used where a floating point value was expected
C:\Programme\GLBasic\Compiler\platform\gpc_temp.cpp:19: aggregate value used where a float was expected
*** FATAL ERROR - Bitte die Compiler-Ausgabe ins Forum kopieren
_______________________________________
*** Fertig ***
Zeit: 0.5 sek
Erstellen: 0 erfolgreich, 1 fehlgeschlagen


Tja, soviel dazu!

Hier das Programm dazu:

// --------------------------------- //
// Project:
// Start: Monday, September 26, 2005
// IDE Version: 2.50920

LOCAL lines$[] // Lokale Variable für die Einträge der Sektion


auswahl = RND (2)+1

IF auswahl = 1
datei = "game.ini"
ENDIF

IF auswahl = 2
datei = "game2.ini"
ENDIF


GetSection(datei, "Control", lines$[]) // Die Sektion Control einlesen
test = GetSectionVal$("test", lines$[]) // Aus den glesenen Einträgen "Test" suchen
angriff = GetSectionVal$("angriff", lines$[])
verteidigung = GetSectionVal$("verteidigung", lines$[])




PRINT test, 0, 0
PRINT angriff, 0, 50
PRINT verteidigung, 0, 100
  summe = INTEGER (angriff * (verteidigung / (verteidigung + angriff)))
PRINT summe, 0, 150
PRINT auswahl, 0, 200


SHOWSCREEN
MOUSEWAIT
END


SUB einlesen:

LOCAL lines$[] // Lokale Variable für die Einträge der Sektion
GetSection("game.ini", "Control", lines$[]) // Die Sektion Control einlesen
test = GetSectionVal$("test", lines$[]) // Aus den glesenen Einträgen "Test" suchen
angriff = GetSectionVal$("angriff", lines$[])
verteidigung = GetSectionVal$("verteidigung", lines$[])


ENDSUB



//IF GetSection("game.ini", "Control", lines$[])
//    FOR i=0 TO BOUNDS(lines$[], 0)-1
//        PRINT "> " + lines$
  • + " = " + lines$[1], 0, i*20
//    NEXT
//ELSE
//    PRINT "Section not found!", 0, 0
//ENDIF

//SHOWSCREEN
//MOUSEWAIT

// ------------------------------------------------------------
// Read until you find a [section] then copy it's contents into
// the array
// ------------------------------------------------------------
FUNCTION GetSection: file$, name$, lines$[]
LOCAL i, start, stop, good, nread, rd$, line$[]
    DIM lines$[0]
    // Find the first line of the required section
    start=0
    // Ignore upper-lower case in sections
    name$=UCASE$(name$)
    FOR start = 0 TO 255
        GETFILE file$, start, rd$
        rd$ = UCASE$(rd$)
        // the line must contain "[", "]" and name$, that's
        // close enough for us ;)
        IF    INSTR(rd$, name$)>-1 AND _
            INSTR(rd$,"[")>-1 AND _
            INSTR(rd$,"]")>-1 THEN GOTO find_end
    NEXT
    RETURN FALSE
find_end:
    // Now find the last line of that section (where a new section beginns)
    rd$=""
    start=start+1
    stop = start
    nread=0
    FOR stop=start TO 255
        GETFILE file$, stop, rd$
        rd$ = Trim$(rd$)
        IF MID$(rd$,0,1) = "[" THEN GOTO do_read
        // skip empty + comment lines
        IF rd$ <> "NO_DATA" AND MID$(rd$,0,1)<>"#" THEN nread=nread+1
    NEXT
    stop=255

do_read:
    IF nread=0 THEN RETURN FALSE
    // now that we know the number of good lines, we can DIM the result
    DIM lines$[nread][2]
    good=0
    FOR start=start TO stop
        GETFILE file$, start, rd$
        rd$ = Trim$(rd$)
        IF rd$ <> "NO_DATA" AND MID$(rd$,0,1)<>"#"
            // Split the line at '=' sign
            SPLITSTR(rd$, line$[], "=")
            IF BOUNDS(line$[], 0) = 2

                lines$[good][1] = Trim$(line$[1])
                // Make left of '=' upper case and trim whitespace
                lines$[good][0] = Trim$( UCASE$(line$[0]) )
                // Is this a good one?
                IF LEN(lines$[good][0]) THEN good=good+1
            ENDIF
            IF nread=good THEN RETURN TRUE
        ENDIF
    NEXT
    // this should never be reached
    RETURN FALSE
ENDFUNCTION


// ------------------------------------------------------------- //
// -=#  GETSECTIONVAL  #=-
// Find the value of a section's entry
// ------------------------------------------------------------- //
FUNCTION GetSectionVal$: value$, lines$[]
LOCAL i
    value$=UCASE$(value$)
    FOR i=0 TO BOUNDS(lines$[], 0)-1
        IF lines$
  • = value$ THEN RETURN lines$[1]
   NEXT
RETURN ""
ENDFUNCTION


// ------------------------------------------------------------- //
// Trim whitespace at start and end of a string
// ------------------------------------------------------------- //
FUNCTION Trim$: in$
LOCAL start, fin, a$
    FOR start=0 TO LEN(in$)
        a$=MID$(in$, start,1)
        IF a$<>" " AND a$<>"\t" THEN GOTO skip
    NEXT
    skip:

    FOR fin=LEN(in$)-1 TO start STEP -1
        a$=MID$(in$, fin, 1)
        IF a$<>" " AND a$<>"\t" THEN RETURN MID$(in$, start, fin-start+1)
    NEXT
RETURN ""
ENDFUNCTION
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

Kitty Hello

datei = "game.ini"
sollte doch besser datei$ = "game.ini" heissen, oder? ;)

WPShadow

Erwischt! *g*

Peinlich!!! Sorry!
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est