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 - Bauklotz

Pages: 1 ... 27 28 29 30 31 [32] 33 34 35 36 37 ... 53
466
Modification Help / Re: HTTPObject PHP parameters
« on: October 02, 2010, 09:48:50 AM »
Bump due to great importance.

467
Off Topic / Re: Ask a stupid question, get a stupid answer.
« on: October 02, 2010, 09:47:47 AM »
 :nes:

What color is

468
Off Topic / Re: OBJECTION!
« on: October 02, 2010, 09:37:29 AM »
also


Also @thecreatorofthistopic

469
Off Topic / Re: OBJECTION!
« on: October 02, 2010, 09:34:38 AM »

470
Off Topic / Re: I got suspended... Again... (4th time, 2 years..)
« on: October 02, 2010, 09:24:52 AM »
I am captain Gordon Freeman of the Intergalactic House of Pancakes ordering this thread to die.

471
Off Topic / Re: Ask a stupid question, get a stupid answer.
« on: October 02, 2010, 09:19:37 AM »
\c5

Why is \t a girl?

472
Modification Help / Re: HTTPObject PHP parameters
« on: October 02, 2010, 07:19:51 AM »
Also, HTTPObjects have a .post function, but the arguments dont make sense.
.post(Address, RequestURI, query, post);

473
Modification Help / HTTPObject PHP parameters
« on: October 02, 2010, 07:16:43 AM »
Okay, from the beginning. I am locally hosting a website and I have a PHP script which contains this:
Code: (PHP) [Select]
<?php
    file_put_contents
("./stuff.txt",$_GET["variable"]);
?>


And then in TS, I do this:
Code: (TorqueScript) [Select]
new HTTPObject(Intrastuff);
Intrastuff.get("localhost:80","/filename.php?variable=nothing");

Okay, on the server, before running the TS code, there is no file except filename.php
Now I run the TS code, and a file called stuff.txt is created. I open it, and the contents are just blank, "".
I tried making it echo the $_GET["variable"], but its still just "". I'm guessing this is a problem with TS.

How would I properly send a request of the PHP script, but passing arguments?

474
Gallery / Re: Tractor
« on: October 01, 2010, 10:28:17 AM »
k.

475
Gallery / Tractor
« on: October 01, 2010, 10:07:20 AM »
TRACTOR

ITS A TRACTOR

SERIOUSNESS


476
Suggestions & Requests / Re: Creepers.
« on: October 01, 2010, 08:34:49 AM »
I already posted a huge creeper AI above.

477
Suggestions & Requests / Re: Creepers.
« on: October 01, 2010, 03:27:56 AM »
Aaand spawning.

Code: [Select]
function RC_SpawnBot(%id,%pos,%ss)
{
   if(!isObject("RC_Bot_"@%id)) return;
   if(!isObject(RC_Bots)) new SimSet(RC_Bots);
   %bot = new AIPlayer()
   {
      position = %pos;
      datablock = nametoid("RC_Bot_"@%id);
      type = %id;
   };
   if(strLen(%ss) < 1) %ss = 1;
   if(%id $= slime)
      %bot.slimeSize = %ss;
   RC_Bots.add(%bot);
   cancel(RC_Bots.think);
   RC_Bots_think(RC_Bots);
   return %bot;
}

478
Suggestions & Requests / Re: Creepers.
« on: October 01, 2010, 03:20:35 AM »
And the thinking script.

Code: [Select]
function RC_Bots_think(%this)
{
   // Realcraft Bots, version 1.5
   
   // Target Finding, Following and Checking   
   
   cancel(%this.think); // Cancel any double-runs.
   if(!isObject(%this))
      return;
   for(%i=0;%i<%this.getCount();%i++) // Do a loop on all bots.
   {
      %b=%this.getObject(%i); // Get the bot object.
      if(%b.getState() $= Dead) // We don't want to control dead bots.
         continue;
      %t=%b.target; // Get the target.
      if(isObject(%t) && %t.getState() !$= Dead) // Do we have a target?
      {
         // Yes! Get distance to target.
         %dist = vectorSub(%b.getPosition(),%t.getPosition());
         %dist = getWord(%dist,0) + getWord(%dist,1) + getWord(%dist,2);
         if(%dist >= 45 || %dist <= -45) // Has target escaped?
         {
            // Damn, abandon target.
            %b.target = 0;
            continue;
         }
         // Find height distance
         %hdif = getWord(%t.getPosition(),2) - getWord(%b.getPosition(),2);
         if(%hdif >= 1 && %b.getDataBlock().jumper) // Is target above us, and can we jump?
         {
            %b.playThread(1,jump); // Play Jump Animation
            %b.addVelocity("0 0 12.5"); // Jump!
         }
         while(isEventPending(%b.wanderloop))
            cancel(%b.wanderloop); // We don't want it to wander if we have a 100% good target.
         %b.setMoveDestination(%t.getPosition()); // Go to the target!
      }
      else // So, we DONT have a target?
      {
         // Seems that there is no target, find one.
         for(%i=0;%i<ClientGroup.getCount();%i++) // Search for targets on all clients
         // NOTE FOR ABOVE: Might change this to container raycast sometime.
         {
            %cl = ClientGroup.getObject(%i); // Get the client we found
            if(!isObject(%cl.player)) // We don't want to inspect dead people
               continue;
           
            %bpos=%b.getPosition(); // Save our position
%pos[%cnt++]=%cl.player.getPosition(); // Save their position
%ID[%cnt]=%cl.player; // Save their object
         }
         %shortDist=""; // Reset shortest distance.
         for(%i=1;%i<=%cnt;%i++) // Loop through all saved data.
         {
            %dist=vectorSub(%bpos,%pos[%i]); // Find distance
            if(getSubStr(%dist,0,1) $= "-") // Negative numbers dont matter
               %dist = getSubStr(%dist,1,strLen(%dist));
            if(%dist >= 15) // Damn, its too far away.
               continue;
            if(%shortDist$=""||%dist<%shortDist) // Is this the closest we've found yet?
            {
               %shortDist=%dist; // Sure is, save shortest distance.
               %target=%ID[%i]; // And save the object as the closest.
            }
         }
         if(isObject(%target)) // Did we find anything in range?
         {
            // We did! Set it as target.
            %b.target = %target;
         }
         else if(!isEventPending(%bot.wanderloop))
         {
            // We didn't, begin wandering and search next time.
            %b.wander(50);
         }
      }
   }
   %this.think = schedule(500,0,RC_Bots_think,%this);
}

function Player::wander(%this, %radius)
{
if(isObject(%this))
{
if(%this.getClassName() $= "AIplayer")
{
if(%radius < 1)
{
%radius = 25;
}
         %this.setMoveSpeed(1);
%tpos = %this.getPosition();
%ranV = getRandom(-25, 25) SPC getRandom(-25, 25) SPC 0;
%dest = vectorAdd(%tpos, %ranV);
while(isObject(firstWord(containerRaycast(%tpos, %dest, $TypeMasks::FxBrickAlwaysObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType | $TypeMasks::VehicleBlockerObjectType))))
{
%ranV = getRandom(-25, 25) SPC getRandom(-25, 25) SPC 0;
%dest = vectorAdd(%tpos, %ranV);
if(%i++ > 10) //So the server doesn't crash if it's encased in something
{
break;
}
}
if(vectorDist(%dest, %this.spawnPosition) > %radius)
{
%dest = %this.spawnPosition;
jumpToZ(%this, getWord(2, %this.spawnPosition));
}
         %this.setMoveDestination(%dest, false);
%this.wanderloop = %this.schedule(5000, wander, %radius);
}
}
}
function jumpToZ(%obj, %z)
{
if(isObject(%obj) && strLen(getWord(%dest = %obj.spawnPosition, 2)) > 0)
{
if(%obj.getClassName() $= "AIplayer")
{
%pos = %obj.getPosition();
%obj.setMoveX(0);
if(getRandom() > 0.5)
{
%obj.setMoveX(getRandom(-1,1));
}
if(getWord(%pos, 2) < %z)
{
%obj.botjump();
%obj.jumpsched = %obj.schedule(1000, jumpToZ, %z);
}
}
}
}

479
Suggestions & Requests / Re: Creepers.
« on: October 01, 2010, 03:19:57 AM »
Oh, I completely forgot the registering script.

Code: [Select]
deleteVariables("$BOT::*");
$BOT::TotalBots = 0;

function registerBotType(%team,%id,%ui,%flags,%apflags,%sl,%canJump)
{
      %n = $BOT::TotalBots;
      echo("    [BOTS] Registering "@%ui SPC %team@" ("@%id@")");
      $BOT::TotalBots++;
      $BOT::ID[%n] = %id;
      $BOT::UI[%n] = %ui;
      $BOT::TM[%n] = %team;
      if(!isObject("RC_Bot_"@%id))
      {
         %flags = strReplace(%flags,": ","=");
         %str = "datablock PlayerData(RC_Bot_"@%id@" : PlayerNoJet) { jumper=\""@%canJump@"\"; uiName = \"[RC] Bot: "@%ui@"\"; "@%flags@"};";
         echo("        Registering DATABLOCK and FLAGS...");
         eval(%str);
      }
      echo("        Registering APPEARANCE and FUNCTIONS...");
      %str = "function RC_Bot_"@%id@"::onRemove(%this,%obj) { if(isObject(%obj.emptyshape)) %obj.emptyshape.delete(); } ";
      eval(%str);
      %str = "function RC_Bot_"@%id@"::onAdd(%this,%obj) { "@(%sl ? "%obj.setScale(\"1 1 1.5\");" : "") SPC %apflags@"}";
      eval(%str);
}

package RC_Bots_onAttacked
{
   function swordPRojectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
   {
      //if(%col.getClassName() $= AIPlayer && %obj.client.miniGame $= RC_Minigame)
      if(%col.getClassName() $= AIPlayer)
      {
         if(isFunction(%col.getDataBlock().getName()@"_onAttack"))
         {
            call(%col.getDataBlock().getName()@"_onAttack",%col,%obj.client);
         }
         else
         {
            %col.addHealth(-(%this.directDamage / 3));
            %col.target = %obj.client.player;
         }
      }
      else if(%col.getClassName() !$= Player)
         Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal);
   }
};
activatePackage(RC_Bots_onAttacked);

480
Suggestions & Requests / Re: Creepers.
« on: October 01, 2010, 03:16:30 AM »
I made a Creeper type for Realcraft (blockland remake of Minecraft):

Code: [Select]
registerBotType(
   "mob",
   creeper,
   "Creeper",
   "runForce: 3000; maxForwardSpeed: 4;",
   "%this.loadCreeper(%obj);",
   0
);

function RC_Bot_Creeper::loadCreeper(%this,%obj)
{
   %obj.setFaceName("asciiTerror");
   %obj.unHideNode("skirtHip");
   %obj.setNodeColor("skirtHip","0 1 0 1");
   %obj.setNodeColor("headskin","0 1 0 1");
   %obj.setNodeColor("chest","0 1 0 1");
   %obj.setNodeColor("larm","0 1 0 1");
   %obj.setNodeColor("rarm","0 1 0 1");
   %obj.setNodeColor("lhand","0 1 0 1");
   %obj.setNodeColor("rhand","0 1 0 1");
   %obj.setNodeColor("lshoe","0 1 0 1");
   %obj.setNodeColor("rshoe","0 1 0 1");
   %obj.setNodeColor("pants","0 1 0 1");
}

function RC_Bot_Creeper::onCollision(%this, %obj, %col, %thing, %other)
{
   if(%col.getClassName() !$= Player)
      return;
   if(%obj.getState() $= Dead)
      return;
   if(%col.getState() $= Dead)
      return;
   
   if(%obj.ss_touched)
      return;   
   
   %obj.ss_touched = 1;
   %cl = %col.client;
   centerPrint(%cl,"\c6SSSSSSsss..",1.5);
   %obj.schedule(1500,spawnExplosion, rocketLauncherProjectile, 1.3, %col.client);
   %obj.schedule(1550,kill);
}

Pages: 1 ... 27 28 29 30 31 [32] 33 34 35 36 37 ... 53