Discuss Scratch

mobluse
Scratcher
100+ posts

Would like ticker to scroll text right to left

I have this ticker that scrolls text left to right in a project, but I would like it to scroll in the other direction (right to left). Is this possible without to much or slow code?
when I receive [ticker v]
set [Commands v] to [A=&, O=|, X=^, C=~, ←=<<, →=>>, P=+, M=-, T=*, D=/, U=%, N=(-), S=swap, ↑=roll up, ↓=roll down, 1-9=# digits, R=reset, E=enter, ]
set [_commandsStore v] to (Commands)
set [_lenCommands v] to (length of (Commands))
forever
set [Commands v] to (join (letter (_lenCommands) of (Commands)) (Commands))
wait (0.3) secs
if <(length of (Commands)) > ((2) * (_lenCommands))> then
set [Commands v] to (_commandsStore)
end
end
https://scratchblocks.github.io/generator/#project=18323862
footsocktoe
Scratcher
1000+ posts

Would like ticker to scroll text right to left

mobluse wrote:

I have this ticker that scrolls text left to right in a project, but I would like it to scroll in the other direction (right to left). Is this possible without to much or slow code?
when I receive [ticker v]
set [Commands v] to [A=&, O=|, X=^, C=~, ←=<<, →=>>, P=+, M=-, T=*, D=/, U=%, N=(-), S=swap, ↑=roll up, ↓=roll down, 1-9=# digits, R=reset, E=enter, ]
set [_commandsStore v] to (Commands)
set [_lenCommands v] to (length of (Commands))
forever
set [Commands v] to (join (letter (_lenCommands) of (Commands)) (Commands))
wait (0.3) secs
if <(length of (Commands)) > ((2) * (_lenCommands))> then
set [Commands v] to (_commandsStore)
end
end
https://scratchblocks.github.io/generator/#project=18323862

I happen to have a project that scrolls text right to left. Maybe some of it will be useful to you… https://scratch.mit.edu/projects/103427939/
mobluse
Scratcher
100+ posts

Would like ticker to scroll text right to left

footsocktoe wrote:

I happen to have a project that scrolls text right to left. Maybe some of it will be useful to you… https://scratch.mit.edu/projects/103427939/
It's interesting that you use one clone for each letter in the shown text. I would prefer if I could scroll a variable-box from right to left since it is less job to include any UTF8-characters in the text.
asivi
Scratcher
1000+ posts

Would like ticker to scroll text right to left

Start creating a variable containing “space” characters until you fill the screen width, then go replacing last character with the first letter of your string and moving those you replaced previously 1 position and adding the needed “spaces” until it backs to original(all spaced) when the entire string you want scroll has be showed.

Last edited by asivi (May 27, 2017 17:27:58)

asivi
Scratcher
1000+ posts

Would like ticker to scroll text right to left

Hi https://scratch.mit.edu/projects/163518932 might be useful for your purpose.
Greets.
mobluse
Scratcher
100+ posts

Would like ticker to scroll text right to left

asivi wrote:

Hi https://scratch.mit.edu/projects/163518932 might be useful for your purpose.
Greets.
Thanks! This shows that it is possible to do it rather fast, but this does not roll around like I wanted. Now I did this in Bitwise Calculator Hexadecimal Decimal Octal Binary:
when I receive [ticker v]
set [Commands v] to [A=&, O=|, X=^, C=~, ←=<<, →=>>, P=+, M=-, T=*, D=/, U=%, N=(-), S=swap, ↑=roll up, ↓=roll down, 1-9=# digits, R=reset, E=enter, ]
forever
wait (0.2) secs
roll_commands :: custom
set [Commands v] to (join (_commandsStore) (letter (1) of (Commands)))
end

define roll_commands
set [_commandsStore v] to []
set [_letter# v] to [2]
repeat ((length of (Commands)) - (1))
set [_commandsStore v] to (join (_commandsStore) (letter (_letter#) of (Commands)))
change [_letter# v] by (1)
end

Procedure roll_commands should run without screen refresh.

Maybe this can be improved.

Powered by DjangoBB