Blockland Forums > Modification Help
Code isn't working
<< < (2/2)
Slicksilver:
I can't discern anything from this, but it doesn't look like that Nexus. It appears he's trying to raise a variable to be above another one. Not really sure what he's trying to do.

I literally went through your script as the game would do and had to figure out what you were doing that way. Jesus.

getRangForZ(50);

Then, this goes:
   %r = "0 10"; //
   while(inRange(50,%r) == false)
   {
      %r = getWord(%r,0) + 10 SPC getWord(%r,1) + 10;
   }

So it's in a loop checking range 50,%r until it's true.

   if(50 >= 0 && 50 <= 10)

50 is not <= 10, so this returns 0 (rather nothing, but oh well)

Back to the loop, increase first and second word by 10

   if(50 >= 10 && 50 <= 20)

Still nope.

   if(50 >= 20 && 50 <= 30)

Still nope.

   if(50 >= 30 && 50 <= 40)

Annddd. Nope.

   if(50 >= 40 && 50 <= 50)

Suddenly, yes! It returns "40 50".


So, what all this ends up doing is getting a range of 10 which the number lays between. What nexus said:

function getrange(%z)
{
   %lwr = mfloor(%z/10)*10;
   %upr = %lwr + 10;
   return %lwr SPC %upr;
}

would do:

%lwr = (50/10) * 10; //5 * 10 -> 50
%upr = %lwr + 10; // 50 + 10 = 60
return %lwr SPC %upr; //50 60


so, while they return different things they really do the same thing. Use Nexus'. It's way, way easier to comprehend and way, way easier on the game.
Doomonkey:

--- Quote from: Brian Smithers on February 15, 2012, 03:02:28 PM ---so
what
it should be doing
is finding the range %z is in, counting by tens
like
if z = 21
20 - 30
if z = 41,231
41,230 - 41,240

--- End quote ---
If z equals 40 is it in the range 40-50 or 30-40, because Nexus' script will return 40-50.
Navigation
Message Index
Previous page

Go to full version