Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » list help
- destructo-serpent
-
100+ posts
list help
i'm making a list-based word processor, but i don't know how to make a backspace. how would you delete the last character from a list entry? like:
list entry: hello there
(8 key pressed)
list entry: hello ther
list entry: hello there
(8 key pressed)
list entry: hello ther
Last edited by destructo-serpent (June 11, 2013 20:34:16)
- Tezliov
-
71 posts
list help
The only workaround I can think of is have another hidden list add every individual letter as a different line, and have the main list merge the list together. I'll make an example in a minute.
Edit: Here you go: http://scratch.mit.edu.ezproxyberklee.flo.org/projects/10794390/
Edit: Here you go: http://scratch.mit.edu.ezproxyberklee.flo.org/projects/10794390/
Last edited by Tezliov (June 11, 2013 21:01:43)
- turkey3
-
1000+ posts
list help
One way to do it is to make a variable first called changer and another item#. Just follow this script 
Assume that item 4 is the item of the text you want to backspace on. This works quickest as a custom block, you can call it “backspace”, running without screen refresh.

set [changer] to []
set [item#] to (1)
repeat ((length of (item (4) of list)) - (1))
set [changer] to (join (changer) (letter (item#) of (item (4) of list)
change [item#] by (1)
end
replace item [4] of [list] with (changer)
Last edited by turkey3 (June 11, 2013 22:09:38)
- destructo-serpent
-
100+ posts
list help
One way to do it is to make a variable first called changer and another item#. Just follow this scriptAssume that item 4 is the item of the text you want to backspace on. This works quickest as a custom block, you can call it “backspace”, running without screen refresh.set [changer] to []
set [item#] to (1)
repeat ((length of (item (4) of list)) - (1))
set [changer] to (join (changer) (letter (item#) of (item (4) of list)
change [item#] by (1)
end
replace item [4] of [list] with (changer)
it works! thx

- Discussion Forums
- » Help with Scripts
-
» list help