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

#1 2011-12-11 12:32:29

sn307897
Scratcher
Registered: 2011-04-07
Posts: 3

Hello world? mods?

What wold i use those two scripts for in a game and how?

Offline

 

#2 2011-12-11 13:24:44

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Hello world? mods?

The [ () mod () ] block divides the two numbers and the output is the remainder. It's useful if you want to, say, have your character jump every five seconds. Every time there is no remainder between your timer variable and "5", it jumps.

The join () () block is really cool. Say you have a variable which contains the text "hi," and another one that contains "coolstuff." Use the join block and it'll say "hicoolstuff."

Offline

 

#3 2011-12-12 19:02:52

PaperMario123
Scratcher
Registered: 2011-11-25
Posts: 500+

Re: Hello world? mods?

Well, coolstuff described the mod block pretty well, but I'll say what the join block is good for. Say you are making a game, and have health on a player, and coins (9 per level), and an experience system. You want to get to get experience at the end of the level equal to your health times a decimal version of your coins. You could code it like this: [(health) x [join (.{a decimal point}) (coin amount)], then add it to your script. Say, your health is 80, and you got 5/9 coins. 80 x .5 = 40,  so your experience gained would be 40. (note- I used an x instead of an * to simplify things)


http://i.picasion.com/pic46/52268c4a041cced4c8ed97cc7468f869.gif

Offline

 

#4 2012-01-02 11:49:14

GameGuy64
Scratcher
Registered: 2011-09-22
Posts: 500+

Re: Hello world? mods?

You can use join, for example:
Your sprite asks for your name, if you set a variable to (answer), then the sprite could say:
<say[ <join(Hello )(<{Name}>

Last edited by GameGuy64 (2012-01-02 11:49:41)


http://i45.tinypic.com/25apxc7.png

Offline

 

Board footer