Discuss Scratch

RexNeff
Scratcher
8 posts

Detecting Characters

This Requires two variables: Chars and Letter

when green flag clicked
set [chars] to [� !"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~0123456789]
repeat until <(letter (letter) of (chars)) = [your character]>
set [letter] to [1]
repeat until <(letter (letter) of (chars)) = [your character]>
if <(letter (letter) of (chars)) = [your character]> then
set [letter] to [1]
end
change [letter] by (1)
end

end

The set chars to {} looks weird because I set it to too high an argument. But, in your case, just set it to every possible character you can type.

Last edited by RexNeff (April 24, 2023 23:25:17)

FunFunFun21
Scratcher
84 posts

Detecting Characters

rn vr li brx zdqw wr eh d odpd gudpd uhg sdmdpd iroorz ph dqg rqh ri pb vwxglr
09878901234321
Scratcher
500+ posts

Detecting Characters

You should use a list that contains all of the characters, and use this block.

(item # of () in [list v]::list

Last edited by 09878901234321 (April 24, 2023 23:50:28)

medians
Scratcher
1000+ posts

Detecting Characters

09878901234321 wrote:

You should use a list that contains all of the characters, and use this block.

(item # of () in [list v]::list
Oh my god
https://scratch.mit.edu/discuss/topic/680087/?page=1#post-7175318

medians wrote:

You might want to find where the item is located in the Main List using an index variable:
define find item (string1) in list
set [index v] to [0]
repeat until <(item (index) of [Main List v]) = (string1)>
change [index v] by (1)
end
Also, you'll only want this code to run if the list contains the item or it will overflow.
Then do:
replace item (index) of [Main List v] with [Blank]

Powered by DjangoBB