Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to make something say a certain username.
- obece_clarice
-
Scratcher
1 post
how to make something say a certain username.
I am working on a feature in my game where it shows the username of the player with the world record. I know there is a username block, but I don't know where to go from there.
- NoUsername-King
-
Scratcher
100+ posts
how to make something say a certain username.
I guess you could do this:
when I receive [ game end v]If you meant with cloud variables, then you'll have to encode the username into a number, the send it, then decode it to get the username.. Cloud variables are down anyways so there's no point.
if <(high score) > (score)> then
set [score v] to (highscore)
set [High score username v] to (username)
end
say (join (high score username) (join [ got a high score of ] (high score)))
- theodorwscratcher
-
Scratcher
100+ posts
how to make something say a certain username.
create 9 blank costumes and then add costumes named a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -, _
(excluding the commas and spaces)
Custom blocks are run without screen refresh.
This is useful for encoding strings into numbers, setting the cloud variable to the number and then decoding it back into text again. This should work fine! Please tell me on my profile so that I get a message if you still don't know exactly what do do.
Please use this with credit.
(excluding the commas and spaces)
Custom blocks are run without screen refresh.
define encode [string]
set [encoded v] to []
set [i v] to [1]
repeat (length of (string)
switch costume to (letter (i) of (value)
set [encoded v] to (join (encoded) (costume [number v]
change [i v] by (0)
end
define decode [string]
set [decoded v] to []
set [i v] to [1]
repeat ((length of (value)) / (2)
switch costume to (join (letter (i) of (string)) (letter ((i) + (1)) of (string)
set [decoded v] to (join (decoded) (costume [number v])
change [i v] by (2)
end
This is useful for encoding strings into numbers, setting the cloud variable to the number and then decoding it back into text again. This should work fine! Please tell me on my profile so that I get a message if you still don't know exactly what do do.
Please use this with credit.
- fallseptember
-
Scratcher
100+ posts
how to make something say a certain username.
You will have to use cloud variables because reguler variables reset every time the user changes
- geramihasfood
-
Scratcher
100+ posts
how to make something say a certain username.
I am working on a feature in my game where it shows the username of the player with the world record. I know there is a username block, but I don't know where to go from there.Cloud variables are down, so therefore you can't make anything with them. Try to make another game instead.
- Discussion Forums
- » Help with Scripts
-
» how to make something say a certain username.