I'd recommend using the # suffix so it also works in programs that have OPTION DEFINT.
EDIT: I'd also make the max length a parameter, so it can be used on the lower screen and as part of a line.
And to answer your question, a variable named PERCENT should have a percent value. Perhaps you're looking for PROGRESS#.
Code gives syntax error. Use + for string concatenation. It would also be more useful if there wasn't a space character at the end of lengths that are multiples of 8.
Replying to:SquareFingersI'd recommend using the # suffix so it also works in programs that have OPTION DEFINT.
EDIT: I'd also make the max length a parameter, so it can be used on the lower screen and as part of a line.
And to answer your question, a variable named PERCENT should have a percent value. Perhaps you're looking for PROGRESS#.
length is in pixels, so it doesn't really matter if it's an integer or not.
Replying to:SquareFingersCode gives syntax error. Use + for string concatenation. It would also be more useful if there wasn't a space character at the end of lengths that are multiples of 8.
yeah, that was a typo
as for the space at the end, I'll add
*!!(LENGTH MOD 8) or something
Replying to:SquareFingersCode gives syntax error. Use + for string concatenation. It would also be more useful if there wasn't a space character at the end of lengths that are multiples of 8.
The second string now appears to have only 7 characters: for the indexing to work, you need 8 characters in the string, including one for the condition L MOD 8 == 0, even though that character will be removed from the resulting string by *0.
- I hope I do not annoy, I just want to see this code be the best it can be.
Replying to:SquareFingersCode gives syntax error. Use + for string concatenation. It would also be more useful if there wasn't a space character at the end of lengths that are multiples of 8.
Yeah, another typo.
thanks
woah, you can do string picking using array syntax? what is this wizardry?
It's called
not being terrible at programming
Yeah, strings are kind of like arrays of characters, so you can use most array commands on them, like PUSH, POP, COPY, etc.
Replying to:SquareFingersI'd recommend using the # suffix so it also works in programs that have OPTION DEFINT.
EDIT: I'd also make the max length a parameter, so it can be used on the lower screen and as part of a line.
And to answer your question, a variable named PERCENT should have a percent value. Perhaps you're looking for PROGRESS#.
(also function arguments ignore type suffixes)
Replying to:SquareFingersI'd recommend using the # suffix so it also works in programs that have OPTION DEFINT.
EDIT: I'd also make the max length a parameter, so it can be used on the lower screen and as part of a line.
And to answer your question, a variable named PERCENT should have a percent value. Perhaps you're looking for PROGRESS#.
The code has changed since my comment, and it is true that in the current version of SmileBasic, variable suffixes on actual parameters are meaningless, but the recommendation remains that variable names - including suffix - are better more descriptive than less (until you run into excessive wordiness, which one extra symbol is not).