This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-11-14 20:55:18

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

I dont know something with the mouse.

Hi. I have got an OS basic running in Scratch. I am adding a screensaver. I need to know how to work out how long the mouse has stayed still. Does anyone know how to do this?
Please use the embed Scratch blocks to tell me what to do. Thanks!


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#2 2009-11-14 21:52:21

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

By the way, code is:
Stage:
Script 1:
[blocks]
<when green flag clicked>
<reset timer>
[/blocks]
Sprite2:
Script 1:
[blocks]
<when green flag clicked>
<forever>
<if><<<(<mouse x>  <=>  <x position>)>  <and>  <(<mouse y>  <=>  <y position>)>>>
<switch to costume[costume2]>
<else>
<switch to costume[costume1]> 
<end>
<end>
[/blocks]
Sprite6:
Script 1:
[blocks]
<when green flag clicked>
<forever>
<set x to(<mouse x>)>
<set y to(<mouse y>)>
<end>
[/blocks]
Script 2:
There is a Script 2 but it is far too long.
Yes there are other sprites that don't yet have code.
No there is no Sprite1.


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#3 2009-11-14 22:38:21

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: I dont know something with the mouse.

Um... maybe try this:

When Green Flag Clicked
forever
   set [variable] to (0)
   set [mouse x] to (0)
   set [mouse y] to (0)
   repeat until not (mouse x) = (mouse x) or not (mouse y) = (mouse y)
      change [variable] by (1)
      wait (1) secs
      if (variable) > (30)
         broadcast [screensaver]


It may not work, but it's what I thought of.  smile

Last edited by Chrischb (2009-11-14 22:39:11)


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#4 2009-11-14 22:41:06

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: I dont know something with the mouse.

Cool idea!

First of all... what does the timer have to do with this? I don't see anything about if the timer is over a certain amount.


I'm not sure how to say things by editing your scripts, so I'll say it differently.

•Have a sprite that follows the mouse. It can have ghost effect at 100 or have it hide.
•Have a forever loop that does this: First, it sets two variables (let's call them X and Y) to whatever the X and Y of the mouse sprite is. Next, it checks if the mouse sprite's X and Y equals the amount of the X and Y variables. If they're equal, that shows that the mouse hasn't moved. If they're not equal, it shows that the mouse has been moved. Make the timer reset if the mouse has been moved. Last, it checks if the timer is over a certain amount (let's say 15 seconds). If the timer's value is past 15, have the screensaver show.
Note that Scratch doesn't sense the equals for the timer; the timer changes too quickly and Scratch won't sense it quick enough. Use the greater sign instead of the equals sign; you won't have any problems.


Hope that helps! If there are other questions or problems, just ask.  smile

Last edited by Jonathanpb (2009-11-14 22:43:07)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#5 2009-11-14 22:42:29

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: I dont know something with the mouse.

You posted before me Chrischb! Grrr!

Oh! You put that into one script! Stupid me! I'll edit that.  tongue


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#6 2009-11-14 22:54:51

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Jonathanpb wrote:

Cool idea!

First of all... what does the timer have to do with this? I don't see anything about if the timer is over a certain amount.


I'm not sure how to say things by editing your scripts, so I'll say it differently.

•Have a sprite that follows the mouse. It can have ghost effect at 100 or have it hide.
•Have a forever loop that does this: First, it sets two variables (let's call them X and Y) to whatever the X and Y of the mouse sprite is. Next, it checks if the mouse sprite's X and Y equals the amount of the X and Y variables. If they're equal, that shows that the mouse hasn't moved. If they're not equal, it shows that the mouse has been moved. Make the timer reset if the mouse has been moved. Last, it checks if the timer is over a certain amount (let's say 15 seconds). If the timer's value is past 15, have the screensaver show.
Note that Scratch doesn't sense the equals for the timer; the timer changes too quickly and Scratch won't sense it quick enough. Use the greater sign instead of the equals sign; you won't have any problems.


Hope that helps! If there are other questions or problems, just ask.  smile

Hi! The timer is to say, 'If the mouse is still for so-and-so seconds, initiate screensaver'.
I haven't yet coded this to work. Thanks!

EDIT: I, at first, used 'timer' as a replacement for 'time'. However, I realised it could be useful and that's where the idea for a screensaver from.

Last edited by nobugs (2010-01-01 18:29:07)


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#7 2009-11-14 23:01:57

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: I dont know something with the mouse.

Oh. I didn't see that script, so I was confused.  tongue

Last edited by Jonathanpb (2009-11-14 23:02:15)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#8 2009-11-14 23:26:55

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Thanks guys, you were a great help.
I'm going to keep on asking if I need any more help with problems.
And that is right now.
I know how to do the click thing, but how do you hide sprites?
I want to make a Start menu that appears when you click on the buttons and disappears when you click on a button in it or on an area around it.
Once I have finished this wait a few days/weeks and I will probably post it.
See you!  smile

Last edited by nobugs (2009-11-14 23:31:24)


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#9 2009-11-14 23:39:07

funkymonkey
Scratcher
Registered: 2007-06-03
Posts: 1000+

Re: I dont know something with the mouse.

Chrischb wrote:

Um... maybe try this:

When Green Flag Clicked
forever
   set [variable] to (0)
   set [mouse x] to (0)
   set [mouse y] to (0)
   repeat until not (mouse x) = (mouse x) or not (mouse y) = (mouse y)
      change [variable] by (1)
      wait (1) secs
      if (variable) > (30)
         broadcast [screensaver]


It may not work, but it's what I thought of.  smile

i don't think this will work because the mouse x will always equal the mouse x, no matter what. same with mouse y. instead maybe do
repeat until not (mouse x) = (0) or not (mouse y) = (0)
if you're gonna do it like that


http://i243.photobucket.com/albums/ff67/hprules_photos/banner2.jpg
Kuzimu: Dawn of a New Age                                                                                                  Coming May 2010

Offline

 

#10 2009-11-14 23:49:35

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

funkymonkey wrote:

Chrischb wrote:

Um... maybe try this:

When Green Flag Clicked
forever
   set [variable] to (0)
   set [mouse x] to (0)
   set [mouse y] to (0)
   repeat until not (mouse x) = (mouse x) or not (mouse y) = (mouse y)
      change [variable] by (1)
      wait (1) secs
      if (variable) > (30)
         broadcast [screensaver]


It may not work, but it's what I thought of.  smile

i don't think this will work because the mouse x will always equal the mouse x, no matter what. same with mouse y. instead maybe do
repeat until not (mouse x) = (0) or not (mouse y) = (0)
if you're gonna do it like that

You know what? That was exactly what I didn't get. As in, mousex=mousex and mousey=mousey. LOL. A quote within a quote.

Last edited by nobugs (2009-11-14 23:50:26)


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#11 2009-11-15 00:00:19

funkymonkey
Scratcher
Registered: 2007-06-03
Posts: 1000+

Re: I dont know something with the mouse.

i mean i know what he's talking about, and i think what he meant was to have variables called mousex and mousey, and forever set them to mouse x and mouse y. it seems like it would work, but then it really wouldnt. try Jonathanpb's idea


http://i243.photobucket.com/albums/ff67/hprules_photos/banner2.jpg
Kuzimu: Dawn of a New Age                                                                                                  Coming May 2010

Offline

 

#12 2009-11-15 00:22:18

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

funkymonkey wrote:

i mean i know what he's talking about, and i think what he meant was to have variables called mousex and mousey, and forever set them to mouse x and mouse y. it seems like it would work, but then it really wouldnt. try Jonathanpb's idea

I did and only Jonathanpb's works. But thank him for trying anyway!

Last edited by nobugs (2009-11-15 00:24:40)


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#13 2009-11-15 00:26:27

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Sorry, but nobody seems to notice my other question. How do you hide sprites until they need to be used?


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#14 2009-11-15 00:35:35

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: I dont know something with the mouse.

nobugs wrote:

Sorry, but nobody seems to notice my other question. How do you hide sprites until they need to be used?

[blocks]<when green flag clicked>
<forever>
<if><( <{ SpriteName needs to be used }> <=> 1 )>
<show>
<else>
<hide>
<end>
<end>[/blocks]
There.  smile


~ihaveamac - visit ihaveamac.net

Offline

 

#15 2009-11-15 01:07:19

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

ihaveamac wrote:

nobugs wrote:

Sorry, but nobody seems to notice my other question. How do you hide sprites until they need to be used?

[blocks]<when green flag clicked>
<forever>
<if><( <{ SpriteName needs to be used }> <=> 1 )>
<show>
<else>
<hide>
<end>
<end>[/blocks]
There.  smile

Thanks! I didn't notice show and hide.

Last edited by nobugs (2009-11-15 01:09:34)


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#16 2009-11-15 01:08:51

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Everybody who helped me has their username on the emulated OS's desktop.
If you would like to download it,  search 'windows 7 emulator 1.0alpha' and it will pop up. Test it out in the browser. Make changes if you want, but please DO NOT PUBLISH THEM JUST YET! Wait till the full version comes out.

Last edited by nobugs (2009-11-15 01:20:46)


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#17 2009-11-15 01:47:49

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Sorry guys, one last thing before I publish. Can you upload by saving to a different PC and a file thing on the Scratch website? Tell me whether or not you can. I need it because the computer with Scratch installed is different to the one with the Internet connection. We have a wireless network but it is broken.


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#18 2009-11-15 04:11:29

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: I dont know something with the mouse.

nobugs wrote:

Sorry guys, one last thing before I publish. Can you upload by saving to a different PC and a file thing on the Scratch website? Tell me whether or not you can. I need it because the computer with Scratch installed is different to the one with the Internet connection. We have a wireless network but it is broken.

You can send a project over to another computer and let is share from there... if that's what you're asking.  smile


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#19 2009-11-15 04:18:26

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: I dont know something with the mouse.

Chrischb wrote:

nobugs wrote:

Sorry guys, one last thing before I publish. Can you upload by saving to a different PC and a file thing on the Scratch website? Tell me whether or not you can. I need it because the computer with Scratch installed is different to the one with the Internet connection. We have a wireless network but it is broken.

You can send a project over to another computer and let is share from there... if that's what you're asking.  smile

But the computer that'll be sharing it has to have Scratch (I think, but I'm quite sure).


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#20 2009-11-15 15:59:26

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Guys, thanks anyway. I'll tell you something funny. I was going to recreate SHIFT 1-4 (my favorite one, SHIFT2, is at http://armorgames.com/play/964/shift-2) in Scratch as games you can play in the basic OS. Well, I have collected every single medal, and here is what the guys wrote: 'Classic Character--After spending all this time collecting all the medals, haven't you learnt not to trust me yet? Don't you remember SHIFT 1? Sure, I could let you play as the classic character, but he's dead! Duh!? Please do not mention that you cannot unlock him in your reviews, as that would spoil the 'fun' for others. If you would like to secretly let me know you got here, include in your review: 'The CC is a lie'  tongue '.

Last edited by nobugs (2009-11-15 15:59:42)


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#21 2009-11-15 16:01:17

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Jonathanpb wrote:

Chrischb wrote:

nobugs wrote:

Sorry guys, one last thing before I publish. Can you upload by saving to a different PC and a file thing on the Scratch website? Tell me whether or not you can. I need it because the computer with Scratch installed is different to the one with the Internet connection. We have a wireless network but it is broken.

You can send a project over to another computer and let is share from there... if that's what you're asking.  smile

But the computer that'll be sharing it has to have Scratch (I think, but I'm quite sure).

Do you mean 'I think, but I'm not quite sure'? Also, I meant can you upload it without Scratch?


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#22 2009-11-15 16:28:23

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Hi guys, I am making a script to detect whether or not a button was pressed on the keyboard. Do you know a bit that does this with 2 or 3 lines? As in psuedocode, 'Make sure you reset the timer when any key is pressed, don't care what it is'?


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#23 2009-11-15 22:51:01

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: I dont know something with the mouse.

if key a pressed or key b pressed

so on.  wink


Hai.

Offline

 

#24 2009-11-16 00:12:31

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

fg123 wrote:

if key a pressed or key b pressed

so on.  wink

I have tried doing this, but is there a way to do this without having to choose every single key?


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

#25 2010-01-01 17:55:28

nobugs
Scratcher
Registered: 2009-10-17
Posts: 21

Re: I dont know something with the mouse.

Oops. Guys, it should be uploaded any minute now.


Why Not To Use Ubuntu Rsn. No. 4--No Expensive Office Suites--You know you like to pay $400+ dollars for Microsoft Office Professional. OpenOffice.org must be some kind of communist plot. Why save that money for your kids college or support education intiaitives in the third-world when you can help fund Bill Gates' humble lifestyle.

Offline

 

Board footer