How do I determine how many characters are INPUTted?
Root / Programming Questions / [.]
ResetReloadCreated:
I'm trying to let the player name the character, but I need to limit it so it doesn't print over other text, as it's a text-based game.
LEN(STRING$)Alright. Do you know how I can save the string as an array or something?
How do I save the string? I've been trying for a while and can't figure out how to save and load the name.
You can do this to retrieve the name.
var maxSize=12 var name$ REPEAT INPUT "ENTER_NAME",name$ IF LEN(name$)>=maxSize THEN ? FORMAT("The name can not exceed %d characters ",maxSize) UNTIL LEN(name$)<maxSizeHere are some functions to load or save strings into an array
def saveInArray array[],s$ var i for i=0 to len(s$)-1 push array,asc(s$[i]) next push array,-1 end def loadInArray(array[], pos) var s$="" var i=pos while i<LEN(array) && array[i]!=-1 inc s$,chr$(array[i]) inc i wend return s$ end