Log In  

Hi guys,

A snippet out of something I'm tinkering with. My first attempt at tinkering with pico-8 source so excuse if it's a novice question.

EDIT = 1
EDITTEXT = {}
ADD (EDITTEXT,"NO")
ADD (EDITTEXT,"YES")

FUNCTION _UPDATE()
IF (BTNP(5)) THEN EDIT = EDIT + 1 END
IF EDIT > 2 THEN EDIT = 1 END
END

FUNCTION _DRAW()
PRINT("BUTTON(2) - CLEAR:"..EDITTEXT(EDIT),10,20,3)
END

I'd have dumped the whole listing in as a screenshot gif but not really sure how to do that yet. This example should be toggling no or yes when I hit the 2nd fire button but just gives me a syntax error.

I know I should be able to init it with EDITTEXT = {"NO,"YES") or is it (No,Yes) ???

Basically trying to output a string in a collection within a print line.

Thanks.

P#26262 2016-08-01 10:03 ( Edited 2016-08-02 11:24)

Hi,

your problem isn't implementation logic, but syntax. EDITTEXT is array/table not function. Use [] instead ().

AndyGFX.

P#26266 2016-08-01 11:11 ( Edited 2016-08-01 15:11)

Spot on. Thank you for that. I'll mark resolved.

P#26307 2016-08-02 07:24 ( Edited 2016-08-02 11:24)

[Please log in to post a comment]