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

#1 2012-02-09 07:34:51

Anonymuss
New Scratcher
Registered: 2012-02-09
Posts: 4

Reset Script Help!

First of all I am NOT a newbie to scratch. I am, in fact, quite adept at it (Although I would like to hear your say on that).
I need some help with a reset script on my arcade mode for my incomplete Pacman project here: http://scratch.mit.edu/projects/Anonymuss/2320403
I want to reset my score dots like this:

when gf clicked
forever
if < score  =  [any multiple of score you get after all points are collected] >
set hide to 0
show
(Forget the errors, it will work out in the engine) If there is any way to do this, I would be most grateful (However the only thing I really need help with is the <If score => statement, I can work the rest out by myself)

Many thanks
- Anonymuss ¦D  big_smile  :3

Offline

 

#2 2012-02-09 15:23:35

ads98
Scratcher
Registered: 2011-05-03
Posts: 100+

Re: Reset Script Help!

I may be able to help.

1.)Set up a variable that detects how many 'things' Pacman has ate (sry, forgot what the things are called).

2.)Then do something like this:

if <(Things Pacman Ate) = [whatever]>
     brodcast [stop v]
     set [Score v] to <(Score) + (Things Pacman Ate)>
end
Just tell me if I'm not understanding correctly.

Last edited by ads98 (2012-02-09 15:35:50)


http://blocks.scratchr.org/API.php?user=ads98&amp;action=onlineStatus&amp;type=square http://blocks.scratchr.org/API.php?user=ads98&amp;action=onlineStatus&amp;type=text

Offline

 

#3 2012-02-10 02:54:51

Anonymuss
New Scratcher
Registered: 2012-02-09
Posts: 4

Re: Reset Script Help!

I already have the score system, I just need a way for it to be able to detect any multiple of the amounts of things he eats in the game, without having to rewrite it in an 'or' statement a couple of thousand times.
So say the amount of things I have is 32. I don't want to go around saying 'if score = 32 or 64 or 96 or ETC. I just want a quick and easy way to go 'if score = anything that is a multiple of 32'
would the (_) X (_) Command in operatives work? I'm not sure
thanks anyway
-anonymuss ¦D  big_smile  :3

Offline

 

#4 2012-02-10 11:56:22

Anonymuss
New Scratcher
Registered: 2012-02-09
Posts: 4

Re: Reset Script Help!

Nvm, cracked it  smile
For anyone interested, you basically just have to make 2 score variables, and when one gets to the certain amount, you put a variable called 'reset' to 1 then reset that score.

Offline

 

#5 2012-02-10 11:59:06

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Reset Script Help!

Try using the

((n1)mod(n2))
block. It reports the remainder when dividing n1 by n2. If it reports 0, then you have a multiple. That's how I understand it anyway, take a look at the Wiki page for more information.

EDIT: oh, looks like you found a solution  smile

Last edited by sparks (2012-02-10 12:00:38)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer