Bug in Globals!

Previous topic - Next topic

Schranz0r

Code (glbasic) Select
GLOBAL a = LoadSprite2("r1.png")



WHILE TRUE

DRAWSPRITE a, 10, 10


SHOWSCREEN
WEND
END




FUNCTION LoadSprite2: name$
STATIC ID

IF DOESFILEEXIST(name$)
LOADSPRITE name$,ID
INC ID,1
RETURN ID-1
ENDIF

ENDFUNCTION


Geht net.... wieso ?
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

Moru

Not bug, you can't set dynamicly in globals, you have to do that on a separate line.

Code (glbasic) Select
GLOBAL a
a = LoadSprite2("r1.png")


Kitty Hello

That bug again!?

Moru

When was that gone? :-)

Schranz0r

für meine Begriffe ist es ein Fehler...

Weil normal gehts ja auch


Global a = 1
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

Moru

You can't set it to something variable. A predefined number is fine but calling a function in a struct is not a good idea :-) I would like it to work too, creates cleaner looking code but it isn't working. It was working a year ago but only for one update, then all my programs stopped working and since then I'm using the long way of first creating the variable then assigning it. The reason why it doesn't work is in some other post, can't find it right now.