Blockland Forums > Modification Help
Code isn't working
(1/2) > >>
Brian Smithers:

function getRangeForZ(%z)
{
   %r = "0 10"; //
   while(inRange(%z,%r) == false)
   {
      %r = getWord(%r,0) + 10 SPC getWord(%r,1) + 10;
   }
   return %r;
}

function inRange(%z,%r)
{
   if(%z >= getWord(%r,0) && %z <= getWord(%r,1))
      return 1;
}

I dont know whats wrong with this, but this gets all forgeted up for some reason.
Any help would be great.
Port:
I can't determine what this is meant to do, thus I can't really help you.
Ipquarx:
Looks like some sort of depth indicator/checker, but unless you tell us what it's really for and what it's SUPPOSED to do and what it's NOT doing right, nobody can help you.

Also, ambig title much?
Brian Smithers:
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

Nexus:
Terragen does something like this to round a player's location to the nearest 4x cube

I would suggest

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

Unless I am going crazy and delusional again, this looks to me like it should do what you are asking.
Navigation
Message Index
Next page

Go to full version