The Daily Click ::. Forums ::. Klik Coding Help ::. What does spread value do?
 

Post Reply  Post Oekaki 
 

Posted By Message

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
30th August, 2005 at 11:52:45 -

Whats the difference between spreading a value and setting a value? And what can you do with spread value?

 
n/a

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
30th August, 2005 at 14:59:12 -

So like if I create 6 'Ball' objects and spread value 0 in value A of the 'Ball' object. The 1st instance of 'Ball' will have 0 the 2nd instance of 'Ball' will have 1 the 3rd will have 2 etc?

If thats the case in what order are the numbers spread? Like are objects cretaed sooner assigned a smaller number than latter objects?

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
30th August, 2005 at 21:04:41 -

You can find out quite easily,

make a counter then put an event so the counter shows the objects value of you click on it.

if you're too lazy to do that then I will tell you.

If there are 6 objects and you spread value 0 then the first object you created will be 5 and the last one you created will be 0.

any new objects will become the new 0 so long as you are always spreading value 0

 
.

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
31st August, 2005 at 08:51:15 -

Yes, the Spread Value always starts with the newest object. This can create huge problems. Imagine this situation:

I create a three signposts. When the player touches a signpost, it checks what the alterable value is and displays a different message depending on which one you hit. Spreadvalue numbers my signposts like this:

first Signpost = 2
sec'd Signpost = 1
third Signpost = 0

So i tell MMF that when player hits a Signpost object, AND the id = 2, then it displays a certain message. If it = 1, then it displays a different message. The same goes for an id of 0.

But suppose I then insert a fourth signpost. Now look at the id numbers:

first Signpost = 3
sec'd Signpost = 2
third Signpost = 1
f'rth Signpost = 0

Suddenly all the ID numbers have shifted by 1! So the actions i intended for the first signpost now happen when you touch the second one, and so on. We have to re-do all the events!

So often I prefer to compare spread values by doing this:

NObjects("signpost")-ID("signpost")

That has the effect of reversing the numbers so that the fourth object has an ID of 4, the third has an ID of 3, and so on. If you do it this way, your ID numbers won't keep shifting each time you add a new object.


--

As another little note (and this is SO handy!!), Phizzy was only half right about what Spread Value does.

It basically selects every object that matches the event's conditions, and gives them a unique ID number.

So if you have an event that only affects all objects that are overlapping another object, and spread a value in them, only those objects will be spreaded.

This is SO useful!! It enables you to loop through every object that meets certain conditions and do stuff with them!

 
191 / 9999 * 7 + 191 * 7

Bo Fu



Registered
  02/04/2004
Points
  413

VIP Member
31st August, 2005 at 16:33:28 -

This is really nifty. I was a bit unclear on the concept myself, but this helped quite a bit.

 
If wishes were fishes then we'd all smell like ladies' underwear.
   

Post Reply



 



Advertisement

Worth A Click