Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » variable sur le cloud
- lieutenant_X
- Scratcher
500+ posts
variable sur le cloud
j'ai un problème avec les variables stockées sur le cloud, quand j'envoie ce nombre: 234567, la variable repasse tout de suite sur un nombre par défault (ici 4422354645). sauf que je voudrais qu'il reste sur la valeure envoyée (234567)
voici mon programme:
et là la variable “score” est repassée à la valeurs “4422354645” et ça fait buger mon programme
comment faire?
voici mon programme:
set [☁ score v] to (234567)
set [variable1 v] to (☁ score)
et là la variable “score” est repassée à la valeurs “4422354645” et ça fait buger mon programme
comment faire?
programmeur amateur et passionné toujours prêt à aider. Pour découvrir mes projets et me soutenir : Mon profil.
si (tu aimes mes conseils(::motion)(::#ffffff)(::undefine)::variables) alors
Viens voir mes projets ::motion //Ils sont cools
end
“Demandez, et l'on vous donnera; cherchez, et vous trouverez; frappez, et l'on vous ouvrira.” Luc (11, 9)
- deenfoxx
- Scratcher
100+ posts
variable sur le cloud
j'ai un problème avec les variables stockées sur le cloud, quand j'envoie ce nombre: 234567, la variable repasse tout de suite sur un nombre par défault (ici 4422354645). sauf que je voudrais qu'il reste sur la valeure envoyée (234567)
voici mon programme:set [☁ score v] to (234567)
set [variable1 v] to (☁ score)
et là la variable “score” est repassée à la valeurs “4422354645” et ça fait buger mon programme
comment faire?
(courtesy of Google Translate…)
I have a problem with the variables stored on the cloud, when I send this number: 234567, the variable returns immediately to a default number (here 4422354645). Except that I would like it to remain on the sent sent (234567)
Here is my program:set [☁ score v] to (234567)
set [variable1 v] to (☁ score)
And there the variable “score” is passed to the values “4422354645” and it makes my program bug
how to do?
Just do the opposite… Don't set the cloud variable directly. Set variable1 (or other non-cloud variable) to keep your score, then set the cloud variable “score” with the current score.
set [variable1 v] to (234567)
if <(☁ score) < (variable1)> then // this may not be what you were asking, change to suit your needs
set [☁ score v] to (variable1) // set the cloud value and leave the variable1 as it was
end
(courtesy of Google Translate…)
Faites simplement le contraire … Ne définissez pas directement la variable cloud. Définissez variable1 (ou autre variable non-cloud) pour conserver votre score, puis définissez le “score” de la variable cloud avec le score actuel.
set [variable1 v] to (234567)
if <(☁ score) < (variable1)> then // ce n'est peut-être pas ce que vous demandiez, changez-vous en fonction de vos besoins
set [☁ score v] to (variable1) // définissez la valeur du nuage et laissez la variable1 telle qu'elle était
end
- lieutenant_X
- Scratcher
500+ posts
variable sur le cloud
thanks but it don't operate
programmeur amateur et passionné toujours prêt à aider. Pour découvrir mes projets et me soutenir : Mon profil.
si (tu aimes mes conseils(::motion)(::#ffffff)(::undefine)::variables) alors
Viens voir mes projets ::motion //Ils sont cools
end
“Demandez, et l'on vous donnera; cherchez, et vous trouverez; frappez, et l'on vous ouvrira.” Luc (11, 9)
- deenfoxx
- Scratcher
100+ posts
variable sur le cloud
Worked fine for me… thanks but it don't operate
https://scratch.mit.edu/projects/155665236
Share your project and I can take a look.
- TheLogFather
- Scratcher
1000+ posts
variable sur le cloud
If you are finding that a cloud variable reverts to its previous value within a second or so of you changing it, then it means one of three things…
1) If you are using Internet Explorer or Edge, don't!
These browsers do not work correctly with Scratch Cloud because of the way they aggressively cache the response from the cloud server. If you use IE or Edge with *anyone's* cloud project, it's even possible that you can effectively ruin the cloud values in that project.
Use a different browser (e.g. Firefox, Chrome).
2) If you do not use a project for a while (e.g. if you are editing it for an hour or two, and you don't run it during that time – more specifically, if it doesn't change any cloudvars in that time), it will eventually time out its cloud write-permission token, and that means the cloud server no longer accepts changes to cloud variables. However, the Scratch player continues to read the latest values from cloud every 1.5 seconds or so – meaning that the cloud variable gets reset typically a second or so after you try to change it.
You can easily fix this just by reloading the project, which will renew the cloud write-permission token.
3) If you have a project open in two places as the same user (e.g. two tabs in the same browser, or two different browsers, or two different computers) then only the *most recently loaded* has the write-permission token that the cloud server will accept. That means if you try to change the cloud variable from any other open instances of the project, it will revert back to the previous value a second or so later – it's basically in the same situation as case (2) above.
Only the *latest* place you load the project (as a particular user) has permission to write to cloud.
One very important thing to note if you are in any of these states is that you should NOT try to add/delete/rename any of your cloud variables!
If you do try to make such a change, it will cause your project to become out-of-sync with the cloud server, and that can lead to some problems that are very tedious to fix.
1) If you are using Internet Explorer or Edge, don't!
These browsers do not work correctly with Scratch Cloud because of the way they aggressively cache the response from the cloud server. If you use IE or Edge with *anyone's* cloud project, it's even possible that you can effectively ruin the cloud values in that project.
Use a different browser (e.g. Firefox, Chrome).
2) If you do not use a project for a while (e.g. if you are editing it for an hour or two, and you don't run it during that time – more specifically, if it doesn't change any cloudvars in that time), it will eventually time out its cloud write-permission token, and that means the cloud server no longer accepts changes to cloud variables. However, the Scratch player continues to read the latest values from cloud every 1.5 seconds or so – meaning that the cloud variable gets reset typically a second or so after you try to change it.
You can easily fix this just by reloading the project, which will renew the cloud write-permission token.
3) If you have a project open in two places as the same user (e.g. two tabs in the same browser, or two different browsers, or two different computers) then only the *most recently loaded* has the write-permission token that the cloud server will accept. That means if you try to change the cloud variable from any other open instances of the project, it will revert back to the previous value a second or so later – it's basically in the same situation as case (2) above.
Only the *latest* place you load the project (as a particular user) has permission to write to cloud.
One very important thing to note if you are in any of these states is that you should NOT try to add/delete/rename any of your cloud variables!
If you do try to make such a change, it will cause your project to become out-of-sync with the cloud server, and that can lead to some problems that are very tedious to fix.
Last edited by TheLogFather (April 14, 2017 15:46:48)
Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- lieutenant_X
- Scratcher
500+ posts
variable sur le cloud
merci mais j'ai trouvé et résolu le problème
thanks but i have found and resolve the probleme.
my programme completed is here https://scratch.mit.edu/projects/155481335/#player
thanks but i have found and resolve the probleme.
my programme completed is here https://scratch.mit.edu/projects/155481335/#player
programmeur amateur et passionné toujours prêt à aider. Pour découvrir mes projets et me soutenir : Mon profil.
si (tu aimes mes conseils(::motion)(::#ffffff)(::undefine)::variables) alors
Viens voir mes projets ::motion //Ils sont cools
end
“Demandez, et l'on vous donnera; cherchez, et vous trouverez; frappez, et l'on vous ouvrira.” Luc (11, 9)
- Discussion Forums
- » Help with Scripts
- » variable sur le cloud