Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - portify

Pages: 1 ... 115 116 117 118 119 [120] 121 122 123 124 125 ... 133
1786
Off Topic / Re: Keys you never use?
« on: June 14, 2014, 08:08:36 AM »
I use all of them

What do you use numpad comma for?

1787
Off Topic / Re: Keys you never use?
« on: June 14, 2014, 07:48:43 AM »
my laptop doesn't have it either but it looks like



What? This is probably the most useful non-essential key on any keyboard. It really pisses me off that it isn't present on my laptop. It opens the context menu (right-click) for the current active control.

1788
Gallery / Re: Brick Tessellation
« on: June 14, 2014, 07:34:15 AM »
http://forum.blockland.us/index.php?topic=249470.0

It's a single file which you have to manually execute, enable and configure via the console. Releasing it wouldn't really help.

1789
Misconfiguration on our end. Sure.

It is, because what's almost certainly going on is that you didn't do it right. Therefore, to make it work at all, the matchmaker kicks in and helps (in theory). It was probably down for a bit.

1790
Code: (Extended Defaults.cs) [Select]
/// Returns a tab-delimited string with %item added to %list, if it isn't already.
/// %list: The list of items to add to.
/// %item: The item to add to the list.
function addItemToList(%list, %item)
{
if(hasItemOnList(%list, %item))
return %list;
if(%list $= "") return %item;
return %list TAB %item;
}

/// Returns whether or not a tab-delimited %list contains a given %item.
/// %list: The list of items to check against.
/// %item: The item to check for.
function hasItemOnList(%list, %item)
{
return striPos("\t"@%list@"\t", "\t"@%item@"\t") != -1;
}

/// Returns a tab-delimited string with all instances of %item removed from %list.
/// %list: The list of items to remove from.
/// %item: The item to remove from the list.
function removeItemFromList(%list, %item)
{
%fields = getFieldCount(%list);
for(%i=%fields-1;%i>=0;%i--)
if(getField(%list, %i) $= %item)
%list = removeField(%list, %i);
return %list;
}

These functions all encourage string lists, the usage of which is an extremely bad habit to get into.



Sorry for the long post, but I just went through say, the 25 most readily available folders and dumped arbitrary, useful functions.
I rewrote some of them slightly during the process, so not everything is guaranteed to work. Do point out if that's the case for any of them.

Code: [Select]
// Create a new copy of the object.
function SimObject::clone(%this)
{
  %name = %this.getName();
  %this.setName("CloneBase");

  %clone = new (%this.getClassName())(%name : CloneBase)
  {
    isClone = 1;
  };

  %this.setName(%name);

  if (!isObject(%clone))
  {
    error("ERROR: Failed to clone object");
    return 0;
  }

  %group = %this.getGroup();

  if (isObject(%group))
  {
    %group.add(%clone);
  }

  return %clone;
}

// Check whether or not the method *%name* is available
// from this object's namespace.
function SimObject::hasMethod(%this, %name)
{
  %className = %this.getClassName();

  if (isFunction(%className, %name) || isFunction(%this.getName(), %name))
  {
    return 1;
  }

  if (%className $= "ScriptObject" || %className $= "ScriptGroup")
  {
    return
      isFunction(%this.class, %name) ||
      isFunction(%this.superClass, %name);
  }

  return isFunction(%this.className, %name);
}

// Safely set *%field* to *%value* on the object.
function SimObject::setField(%this, %field, %value)
{
  if (%field !$= "" && %field $= getSafeVariableName(%field))
  {
    eval("%this." @ %field @ "=%value;");
  }
}

// Play the `AudioProfile` *%profile* in 2D to all members of the mini-game.
function MiniGameSO::play2D(%this, %profile)
{
  if (!isObject(%profile))
  {
    return;
  }

  for (%i = 0; %i < %this.numMembers; %i++)
  {
    %this.member[%i].play2D(%profile);
  }
}

// Determine whether any event on the brick is triggered by *%input*.
function FxDTSBrick::hasInputEvent(%this, %input)
{
  for (%i = 0; %i < %this.numEvents; %i++)
  {
    if (%this.eventInput[%i] $= %input)
    {
      return 1;
    }
  }

  return 0;
}

// Determine whether the player would be in a brick if placed at *%position*.
function Player::collidesAt(%this, %position)
{
  %armor = %this.getDataBlock();

  %box = vectorScale(%this.isCrouched() ?
    %armor.crouchBoundingBox : %armor.boundingBox, 0.25);

  initContainerBoxSearch(%position, %box, $TypeMasks::FxBrickObjectType);
  return isObject(containerSearchNext());
}

// Convert *%color*, a RGBA 0.0f-1.0f representation of a color to 0-255.
function floatRGBA(%color)
{
  return
    getWord(%color, 0) / 255 SPC
    getWord(%color, 1) / 255 SPC
    getWord(%color, 2) / 255 SPC
    getWord(%color, 3) / 255;
}

// Convert *%color*, a RGBA 0-255 representation of a color to 0.0f-1.0f.
function integerRGBA(%color)
{
  return
    mFloatLength(getWord(%color, 0) * 255, 0) SPC
    mFloatLength(getWord(%color, 1) * 255, 0) SPC
    mFloatLength(getWord(%color, 2) * 255, 0) SPC
    mFloatLength(getWord(%color, 3) * 255, 0);
}

// Translate *%rgb* from the RGB colorspace into HSL.
function rgbToHsl(%rgb)
{
  %r = getWord(%rgb, 0);
  %g = getWord(%rgb, 1);
  %b = getWord(%rgb, 2);

  %max = getMax3(%r, %g, %b);
  %min = getMin3(%r, %g, %b);

  %lightness = (%max + %min) / 2;

  if (%max == %min)
  {
    return "0 0" SPC %lightness;
  }

  %delta = %max - %min;
  %saturation = %lightness > 0.5 ?
                %delta / (2 - %max - %min) :
                %delta / (%max + %min);

  switch (%max)
  {
    case %r: %hue = (%g - %b) / %delta + (%g < %b ? 6 : 0);
    case %g: %hue = (%b - %r) / %delta + 2;
    case %g: %hue = (%r - %g) / %delta + 4;
  }

  return %hue / 6 SPC %saturation SPC %lightness;
}

// Rotate/offset *%vector* randomly by *%spread* radians.
function vectorSpread(%vector, %spread)
{
  %scalars = getRandomScalar() SPC getRandomScalar() SPC getRandomScalar();
  %scalars = vectorScale(%scalars, %spread);

  return matrixMulVector(matrixCreateFromEuler(%scalars), %vector);
}

// Find the smallest of the 3 values.
function getMin3(%a, %b, %c)
{
  return %a < %b ? (%a < %c ? %a : %c) : (%b < %c ? %b : %c);
}

// Find the biggest of the 3 values.
function getMax3(%a, %b, %c)
{
  return %a > %b ? (%a > %c ? %a : %c) : (%b > %c ? %b : %c);
}

// Return a random floating point value from -1.0f to 1.0f.
function getRandomScalar()
{
  return getRandom() * 2 - 1;
}

// Search for bricks in the way of a given solid line using box searches.
// Returns 1 if an obstruction was found, 0 otherwise.
function hullTrace(%position, %target, %bounds, %limit)
{
  if (%limit $= "")
  {
    %limit = 40;
  }

  %delta = vectorSub(%target, %position);
  %count = vectorLen(%delta) / (vectorLen(%bounds) / 4);

  if (%count > %limit)
  {
    %count = %limit;
  }

  %step = vectorScale(%delta, 1 / %count);

  for (%i = 0; %i < %count; %i++)
  {
    %box = vectorScale(%bounds, 0.25);
    %pos = setWord(%position, 2,
      getWord(%position, 2) + getWord(%box, 2) / 2);

    initContainerBoxSearch(%position, %box, $TypeMasks::FxBrickObjectType);

    if (isObject(containerSearchNext()))
    {
      return 1;
    }

    %position = vectorAdd(%position, %step);
  }

  return 0;
}

// Returns the current time of day (from 0.0f to 1.0f).
function getDayCycleTime()
{
  %time = $Sim::Time / DayCycle.dayLength + DayCycle.dayOffset;
  return %time - mFloor(%time);
}

// Apply the environment settings in *%file*, created by
// `saveEnvironment` or something similar.
function loadEnvironment(%file)
{
  GameModeGuiServer::parseGameModeFile(%file, 1);

  EnvGuiServer::getIdxFromFilenames();
  EnvGuiServer::setSimpleMode();

  if (!$EnvGuiServer::SimpleMode)
  {
    EnvGuiServer::fillAdvancedVarsFromSimple();
    EnvGuiServer::setAdvancedMode();
  }
}

// Change an environment setting without needing a fake client. Implements
// the default functionality - could be written more succintly, but this was
// intended to be as much like the default system as possible.
function setEnvironment(%varName, %value)
{
  if ($EnvGuiServer["::" @ %varName] $= %value)
    return;

  switch$ (%varName)
  {
  case "SimpleMode":
    $EnvGuiServer::SimpleMode = mClamp(%value, 0, 1);
    EnvGuiServer::setSimpleMode();

    if (!$EnvGuiServer::SimpleMode)
    {
      if (!$EnvGuiServer::HasSetAdvancedOnce)
        EnvGuiServer::readAdvancedVarsFromSimple();

      EnvGuiServer::setAdvancedMode();
    }

  case "SkyIdx":
    $EnvGuiServer::SkyIdx = mClamp(%value, 0, $EnvGuiServer::SkyCount);
    setSkyBox($EnvGuiServer::Sky[$EnvGuiServer::SkyIdx]);

  case "WaterIdx":
    $EnvGuiServer::WaterIdx = mClamp(%value, 0, $EnvGuiServer::WaterCount);
    setWater($EnvGuiServer::Water[$EnvGuiServer::WaterIdx]);

  case "GroundIdx":
    $EnvGuiServer::GroundIdx = mClamp(%value, 0, $EnvGuiServer::GroundCount);
    setGround($EnvGuiServer::Ground[$EnvGuiServer::GroundIdx]);

  case "SunFlareTopIdx":
    $EnvGuiServer::SunFlareTopIdx = mClamp(%value, 0, $EnvGuiServer::SunFlareCount);
    %top = $EnvGuiServer::SunFlareTop[$EnvGuiServer::SunFlareTopIdx];
    %bottom = $EnvGuiServer::SunFlareBottom[$EnvGuiServer::SunFlareBottomIdx];
    SunLight.setFlareBitmaps(%top, %bottom);

  case "SunFlareBottomIdx":
    $EnvGuiServer::SunFlareBottomIdx = mClamp(%value, 0, $EnvGuiServer::SunFlareCount);
    %top = $EnvGuiServer::SunFlareTop[$EnvGuiServer::SunFlareTopIdx];
    %bottom = $EnvGuiServer::SunFlareBottom[$EnvGuiServer::SunFlareBottomIdx];
    SunLight.setFlareBitmaps(%top, %bottom);

  case "DayOffset":
    $EnvGuiServer::DayOffset = mClampF(%value, 0, 1);
    DayCycle.setDayOffset($EnvGuiServer::DayOffset);

  case "DayLength":
    $EnvGuiServer::DayLength = mClamp(%value, 0, 86400);
    DayCycle.setDayLength($EnvGuiServer::DayLength);

  case "DayCycleEnabled":
    $EnvGuiServer::DayCycleEnabled = mClamp(%value, 0, 1);
    DayCycle.setEnabled($EnvGuiServer::DayCycleEnabled);

  case "DayCycleIdx":
    $EnvGuiServer::DayCycleIdx = mClamp(%value, 0, $EnvGuiServer::DayCycleCount);
    %dayCycle = $EnvGuiServer::DayCycle[$EnvGuiServer::DayCycleIdx];
    echo("server setting daycycle to " @ %dayCycle);
    loadDayCycle(%dayCycle);

  case "Sunational socialistmuth":
    $EnvGuiServer::Sunational socialistmuth = mClampF(%value, 0, 360);
    Sun.azimuth = $EnvGuiServer::Sunational socialistmuth;
    Sun.sendUpdate();

  case "SunElevation":
    $EnvGuiServer::SunElevation = mClampF(%value, -10, 190);
    Sun.elevation = $EnvGuiServer::SunElevation;
    Sun.sendUpdate();

  case "DirectLightColor":
    $EnvGuiServer::DirectLightColor = getColorF(%value);
    Sun.color = $EnvGuiServer::DirectLightColor;
    Sun.sendUpdate();

  case "AmbientLightColor":
    $EnvGuiServer::AmbientLightColor = getColorF(%value);
    Sun.ambient = $EnvGuiServer::AmbientLightColor;
    Sun.sendUpdate();

  case "ShadowColor":
    $EnvGuiServer::ShadowColor = getColorF(%value);
    Sun.shadowColor = $EnvGuiServer::DirectLightColor;
    Sun.sendUpdate();

  case "SunFlareColor":
    $EnvGuiServer::SunFlareColor = getColorF(%value);
    SunLight.color = $EnvGuiServer::SunFlareColor;
    SunLight.sendUpdate();

  case "SunFlareSize":
    $EnvGuiServer::SunFlareSize = mClampF(%value, 0, 10);
    // Badspot, why not just SunLight.setFlareSize(...);?
    SunLight.flareSize = $EnvGuiServer::SunFlareSize;
    SunLight.sendUpdate();

  case "SunFlareIdx":
    $EnvGuiServer::SunFlareIdx = mClamp(%value, 0, $EnvGuiServer::SunFlareCount);
    // ... what? Why does this exist? There is no "SunFlareIdx" system.
    // Get outta' here.

  case "VisibleDistance":
    $EnvGuiServer::VisibleDistance = mClampF(%value, 0, 1000);
    Sky.visibleDistance = $EnvGuiServer::VisibleDistance;
    Sky.sendUpdate();

  case "FogDistance":
    $EnvGuiServer::FogDistance = mClampF(%value, 0, 1000);
    Sky.fogDistance = $EnvGuiServer::FogDistance;
    Sky.sendUpdate();

  case "FogHeight":
    $EnvGuiServer::FogHeight = mClampF(%value, 0, 1000);
    // Nothing to see here...

  case "FogColor":
    $EnvGuiServer::FogColor = getColorF(%value);
    Sky.fogColor = $EnvGuiServer::FogColor;
    Sky.sendUpdate();

  case "WaterColor":
    $EnvGuiServer::WaterColor = getColorF(%value);

    if (isObject(WaterPlane))
    {
      WaterPlane.color = getColorI($EnvGuiServer::WaterColor);
      WaterPlane.blend = getWord(WaterPlane.color, 3) < 255;
      WaterPlane.sendUpdate();
    }

    updateWaterFog();

  case "WaterHeight":
    $EnvGuiServer::WaterHeight = mClampF(%value, 0, 100);

    if (isObject(WaterPlane))
    {
      %pos = getWords(GroundPlane.getTransform(), 0, 2);
      %pos = vectorAdd(%pos, "0 0" SPC $EnvGuiServer::WaterHeight);

      WaterPlane.setTransform(%pos SPC "0 0 1 0");
      WaterPlane.sendUpdate();

      updateWaterFog();

      if (isObject(WaterZone))
      {
        %pos = vectorSub(%pos, "0 0 99.5");
        %pos = vectorSub(%pos, "500000 -500000 0");
        WaterZone.setTransform(%pos SPC "0 0 1 0");
      }
    }

  case "UnderWaterColor":
    $EnvGuiServer::UnderWaterColor = getColorF(%value);

    if (isObject(WaterZone))
    {
      WaterZone.setWaterColor($EnvGuiServer::UnderWaterColor);
    }

  case "SkyColor":
    $EnvGuiServer::SkyColor = getColorF(%value);
    // Something is off about this one...
    Sky.skyColor = $EnvGuiServer::SkyColor;
    Sky.sendUpdate();

  // Should probably combine this into one
  // case "WaterScrollX" or "WaterScrollY":
  case "WaterScrollX":
    $EnvGuiServer::WaterScrollX = mClampF(%value, -10, 10);
    $EnvGuiServer::WaterScrollY = mClampF($EnvGuiServer::WaterScrollY, -10, 10);

    if (isObject(WaterPlane))
    {
      WaterPlane.scrollSpeed = $EnvGuiServer::WaterScrollX SPC $EnvGuiServer::WaterScrollY;
      WaterPlane.sendUpdate();
    }

    if (isObject(WaterZone))
    {
      %fx = $EnvGuiServer::WaterScrollX * 414;
      %fy = $EnvGuiServer::WaterScrollY * -414;

      WaterZone.appliedForce = %fx SPC %fy SPC 0;
      WaterZone.sendUpdate();
    }

  case "WaterScrollY":
    $EnvGuiServer::WaterScrollY = mClampF(%value, -10, 10);
    $EnvGuiServer::WaterScrollX = mClampF($EnvGuiServer::WaterScrollX, -10, 10);

    if (isObject(WaterPlane))
    {
      WaterPlane.scrollSpeed = $EnvGuiServer::WaterScrollX SPC $EnvGuiServer::WaterScrollY;
      WaterPlane.sendUpdate();
    }

    if (isObject(WaterZone))
    {
      %fx = $EnvGuiServer::WaterScrollX * 414;
      %fy = $EnvGuiServer::WaterScrollY * -414;

      WaterZone.appliedForce = %fx SPC %fy SPC 0;
      WaterZone.sendUpdate();
    }

  case "GroundColor":
    $EnvGuiServer::GroundColor = getColorF(%value);

    if (isObject(GroundPlane))
    {
      GroundPlane.color = getColorI($EnvGuiServer::GroundColor);
      GroundPlane.blend = getWord(GroundPlane.color, 3) < 255;
      GroundPlane.sendUpdate();

      Sky.renderBottomTexture = getWord(GroundPlane.color, 3) <= 0);
      Sky.noRenderBans = Sky.renderBottomTexture;
      Sky.sendUpdate();
    }

  case "GroundScrollX":
    $EnvGuiServer::GroundScrollX = mClampF(%value, -10, 10);
    $EnvGuiServer::GroundScrollY = mClampF($EnvGuiServer::GroundScrollY, -10, 10);

    if (isObject(GroundPlane))
    {
      GroundPlane.scrollSpeed = $EnvGuiServer::GroundScrollX SPC $EnvGuiServer::GroundScrollY;
      GroundPlane.sendUpdate();
    }

  case "GroundScrollY":
    $EnvGuiServer::GroundScrollY = mClampF(%value, -10, 10);
    $EnvGuiServer::GroundScrollX = mClampF($EnvGuiServer::GroundScrollX, -10, 10);

    if (isObject(GroundPlane))
    {
      GroundPlane.scrollSpeed = $EnvGuiServer::GroundScrollX SPC $EnvGuiServer::GroundScrollY;
      GroundPlane.sendUpdate();
    }

  case "VignetteMultiply":
    $EnvGuiServer::VignetteMultiply = mClamp(%value, 0, 1);
    sendVignetteAll();

  case "VignetteColor":
    $EnvGuiServer::VignetteColor = getColorF(%value);
    sendVignetteAll();

  default:
    return 0;
  }

  return 1;
}

1791
A couple months ago my tablet was glitching out big time and the same happened
It left only 1 friend on

She was the chosen one.

1792
Gallery / Re: Brick Tessellation
« on: June 13, 2014, 03:34:06 PM »
this is the same sort of attention whoring/baiting thing port does. he posts lots of images of something he could VERY easily release, and even has to certain users. he then gets lots of attention on it, then says he wont release for some reason.

I released soft shadows and made several updates for it, what are you talking about?

1794
You shouldn't post in this topic if you have a download or upload rate less than 50 Mbit/s.

1795
THE GAYMER
PCPartPicker part list / Price breakdown by merchant

CPU: Intel Xeon E5-2697 V2 2.7GHz 12-Core Processor  ($2534.98 @ SuperBiiz)
CPU Cooler: Swiftech H320 55.0 CFM Liquid CPU Cooler  ($149.45 @ NCIX US)
CPU Cooler: Swiftech H320 55.0 CFM Liquid CPU Cooler  ($149.45 @ NCIX US)
Thermal Compound: Arctic Cooling MX-2 65g Thermal Paste  ($31.77 @ Amazon)
Motherboard: Asus Z9PE-D8 WS SSI EEB Dual-CPU LGA2011 Motherboard  ($499.99 @ SuperBiiz)
Memory: Avexir Core Series 8GB (2 x 4GB) DDR3-3200 Memory  ($1999.99 @ Newegg)
Memory: Avexir Core Series 8GB (2 x 4GB) DDR3-3200 Memory  ($1999.99 @ Newegg)
Memory: Avexir Core Series 8GB (2 x 4GB) DDR3-3200 Memory  ($1999.99 @ Newegg)
Memory: Avexir Core Series 8GB (2 x 4GB) DDR3-3200 Memory  ($1999.99 @ Newegg)
Storage: OCZ Z-Drive R4 CM84 600GB PCI-E Solid State Drive  ($4529.29 @ Amazon)
Storage: OCZ Z-Drive R4 CM84 600GB PCI-E Solid State Drive  ($4529.29 @ Amazon)
Storage: OCZ Z-Drive R4 CM84 600GB PCI-E Solid State Drive  ($4529.29 @ Amazon)
Storage: OCZ Z-Drive R4 CM84 600GB PCI-E Solid State Drive  ($4529.29 @ Amazon)
Video Card: EVGA GeForce GTX Titan Z 12GB Superclocked Video Card (2-Way SLI)  ($3199.99 @ Amazon)
Video Card: EVGA GeForce GTX Titan Z 12GB Superclocked Video Card (2-Way SLI)  ($3199.99 @ Amazon)
Case: Cooler Master Cosmos II (Black) ATX Full Tower Case  ($259.99 @ Newegg)
Power Supply: LEPA G Series 1600W 80+ Gold Certified Fully-Modular ATX Power Supply  ($293.17 @ Amazon)
Optical Drive: Archgon CB-5021-GB Blu-Ray/DVD/CD Writer  ($109.99 @ Amazon)
Operating System: Microsoft Windows 8.1 - 64-bit (OEM) (64-bit)  ($95.98 @ OutletPC)
Monitor: NEC MD211G5 21.3" Monitor  ($11619.17 @ Mwave)
Monitor: NEC MD211G5 21.3" Monitor  ($11619.17 @ Mwave)
Monitor: NEC MD211G5 21.3" Monitor  ($11619.17 @ Mwave)
Monitor: NEC MD211G5 21.3" Monitor  ($11619.17 @ Mwave)
Case Fan: Lamptron QFR1212GHE-PWM 210.4 CFM 120mm  Fan  ($39.99 @ Newegg)
Case Fan: Lamptron QFR1212GHE-PWM 210.4 CFM 120mm  Fan  ($39.99 @ Newegg)
Case Fan: Lamptron QFR1212GHE-PWM 210.4 CFM 120mm  Fan  ($39.99 @ Newegg)
Case Fan: Lamptron QFR1212GHE-PWM 210.4 CFM 120mm  Fan  ($39.99 @ Newegg)
Headphones: Sennheiser HD800 Headphones  ($1479.99 @ Amazon)
Headphones: Sennheiser HD800 Headphones  ($1479.99 @ Amazon)
Headphones: Sennheiser HD800 Headphones  ($1479.99 @ Amazon)
Headphones: Sennheiser HD800 Headphones  ($1479.99 @ Amazon)
Speakers: Audioengine A2 (Black) 30W 2ch Speakers  ($199.00 @ Amazon)
Other: LIFETIME SUPPLY OF DORITOS ($21474836.47)
Other: MOUNTAIN DEW ($21474836.47)
Total: $43039070.41
Prices include shipping, taxes, and discounts when available
Generated by PCPartPicker 2014-06-12 16:23 EDT-0400god i wish i could afford that :(((((

That's really bad. 2.7 GHz? What are you on?

1796
Gallery / Re: Throwing Lance [MACHINIMA]
« on: June 12, 2014, 04:13:09 AM »
whoa

what gpu do you have, lol

Mediocre Radeon HD 7870; it's just a version that sacrifices artifacts at certain angles for a higher FPS.

1798
Because guard is a reliable force, Family and Guards can work together to narrow down the bad guy.

EDIT: By the way, check out Plastiware's new BGM he's making for this!
https://soundcloud.com/plastiware/here-noir-there

But.. the whole point of the "infiltrated mansion"-y round type is that one of the guards or servants is a murderer.

1799
Modification Help / Re: Get random float?
« on: June 11, 2014, 04:43:05 AM »
What do you mean by "a random decimal"?

1800
Warning,  while you were typing a new reply has been posted. You may wish to review your post.

Turn it off?

Pages: 1 ... 115 116 117 118 119 [120] 121 122 123 124 125 ... 133