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

Pages: 1 2 3 [4] 5 6 7 8 9 ... 19
46
Modification Help / Re: Strip Trailing Zeros
« on: November 13, 2011, 02:18:47 AM »
Also, this:

Code: [Select]
function typeOf(%value)
{
if(isObject(%value))
return "object";

%dot = strPos(%value,".");

if(%dot == -1 && %value $= mFloatLength(%value,0))
return "integer";
if(%dot != -1 && %value * 1 $= mFloatLength(%value,strLen(%value) - %dot - 1))
return "float";

return "string";
}


try this with your function:
echo( typeOf(12) );

gives back "object" instead of "integer"

47
Modification Help / Re: Math with Very large numbers using Strings
« on: November 13, 2011, 02:14:31 AM »
Numbers stored in Scriptobjects eh...
Mine does not use scriptobjects, allthough I could use one to store the functions, mine is just using strings, simply strAdd("235787448", "31364973"); and it will return the answer in about 50 lines of code without cleaning up, and with all the comments.
well the script object makes it easier to store stuff about the number: +/- and such
I also split the number into groups of 5 digits and let torque do the math on the smaller groups - makes it much faster when you have a lot of numbers to add, or have to add to the big number really fast.

Try these with your script and see what you get:
strAdd("100","100")
strAdd("100000", "100000")
strAdd("100", "-50")
strAdd("100", "-100")
strAdd("100000", "-50000")
strAdd("100000", "-100000")


Quote
Allthough its strange, when i try to open the cs, it says it's a .ogg file.
Sounds like your browser is messed up. 
Try "save as" ?

48
Modification Help / Re: Math with Very large numbers using Strings
« on: November 12, 2011, 10:27:14 PM »

Also, Red_Guy, if you would like, we could collaborate and make a division function.
PS: why is it required to have a function create a number from a string? the engine does that automatically.
and how many lines are your functions? I cant view the file because im using a DSi.
The big numbers are stored as script objects - not strings. thats why you need a function to create a number.  I also use a function because when the engine creates a number from a really long string, it changes it into scientific notation and that messes everything up -- which is the whole point behind writing your own math functions.

Also its a good idea to write a simple method to test your add/subtract functions to make sure they are getting the right answer when you change/tweak stuff

The file has 505 lines in it.  not really that big when compared to other files.

Multiply & divide would be really nice to have. let me know if you get anywhere on that part.

49
Modification Help / Re: Math with Very large numbers using Strings
« on: November 12, 2011, 09:52:54 PM »
I'll save you guys some of the hassle here.

This is the script I wrote for unlimited mining to handle VERY large numbers.  It handles up to 20 digits with no problems.  In theory it will handle an unlimited but 20 is the max thats been used in my server.
you can do add, subtract, greater than and less than.  no multiply, no divide.

to use:
echo( BigNumberFromString("1234567890123").add("1234567").display() );

gives this:
1234569124690

where normally you would see:
echo(1234567890123+1234567);
1.91351e+009

in a script:
Code: [Select]
%money = BigNumberFromString(  some really big number here );
%money.add( another really big number );
echo(%money.display() );
%money.subtract("50000000000000000000");
echo(%money.display() );

50
Development / Re: Blockland Launcher r1357
« on: October 12, 2011, 01:18:32 AM »
well on my windows7 box, it seems to have made things worse.

running the launcher directly works fine.
but when I try to start a dedicated server I get this:
Code: [Select]
//////////////////////////////////////////////////
//  Blockland Launcher - Dedicated Server Mode  //
//////////////////////////////////////////////////
%
Downloading manifest from 'http://update.blockland.us/latestVersion.php'...
76488 bytes retrieved
Could not open '"D:\games\blockland-1"/latestManifest.dat' for writing manifest
ERROR: sqlite error 14 - unable to open database file
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/9c5ea6ea43448e11750ff6becbd4f4f9d50d5bfa
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/cd7df5467c9804da39e7f6c4bcc0ba79a2bc8418
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/7e1c52f80e338d944dd42dd3fce461daad6d23b2
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/751f553cfd3d9ee3ba3d58a49b1301e54d749e32
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/81ad77dfc8304dc5068041feb263f7c9191be49c
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/e1caf6b7ef8fc2dd41f94bec5191a0bd37ee0309
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/f81acb425087b0aa86043d8815d960320dde2d6d
Got non-CURLE_OK result on a request, result was 3
 - Request was for ''
Requesting file from CDN: http://cloud.blockland.us/blobs/d64481d5f1dc5cedc66a3f87c39f42e50fb0cb27
ERROR: BlobContainer::snapshotBuffer() - sqllite error 21
%

And then a popup error "blockland launcher could not write to the cache database"
so I deleted cache.db and re-ran.  and got the same error.


Reverting back to the original launcher for now.

51
Help / Re: "Got non-CURLE_OK result on a request, result was 3"
« on: October 12, 2011, 12:52:42 AM »
Delete your cache.db and restart blockland.

I had the same errors in game, and they went away after removing the cache.db

52
General Discussion / Re: Red_Guy's Mining
« on: October 11, 2011, 10:58:14 PM »
The gun has 2 purposes

1) defend your mine from n00bs
2) destroy cement blocks.

If your getting shot at -- shoot back.  you have a gun too.

now if 1 person is killing you over and over, eventually the server will take their gun away.  if EVERYONE is killing you, chances are your doing something to piss them off.


53
Modification Help / Re: Problem with circle generator.
« on: September 21, 2011, 11:27:42 PM »
This seems to work -- but its a bit laggy when the circles get big
Code: [Select]
function Player::dobrickstuff(%player, %pos, %datablock)
{
        %playerPos = %player.tempBrick.getPosition();
        %position = vectorAdd(%playerPos, %pos);
        %brick = new fxDTSBrick()
        {
                client = %player.client;
                datablock = %datablock;
                position = %position;
                rotation = "0 0 0 0";
                colorID = %player.client.currentColor;
                scale = "1 1 1";
                angleID = "0";
                colorfxID = "0";
                shapefxID = "0";
                isPlanted = 1;
                stackBL_ID = %player.client;
        };
        %brick.setTrusted(1);
        %brick.plant();
        %player.client.brickGroup.add(%brick);
}

function makeEllipse(%player, %r1, %r2, %scale, %addedZ)
{
  %steps = (3.14159265 * %r1 * %r1) / 0.5;
  %inc = 360 / %steps;
  echo("%r1: " @ %r1 @ " steps: " @ %steps @ " inc: " @ %inc);



        if(%r2 > 0)
        {
                for(%i = 0; %i < 360; %i+= %inc)
                {
                        %x = %r1 * mFloatLength(mCos(mRadToDeg(%i)), 6);
                        %y = %r2 * mFloatLength(mSin(mRadToDeg(%i)), 6);
                        %player.doBrickStuff(%x SPC %y SPC 0 + %addedZ, Brick1x1Data);
                }
        }
        else
        {
                for(%i = 0; %i < 360; %i+= %inc)
                {
                        %x = %r1 * mFloatLength(mCos(mRadToDeg(%i)), 6);
                        %y = %r1 * mFloatLength(mSin(mRadToDeg(%i)), 6);
                        %player.doBrickStuff(%x SPC %y SPC 0 + %addedZ, Brick1x1Data);
                }
        }
}


function serverCmdMakeCircle(%client, %r1, %r2)
   {
    if ( !isObject(%client.player.tempBrick) )
      {
       messageClient(%client, '', "place a ghost brick first");
       return;
      }
    makeEllipse(%client.player , %r1, %r2, 0);
   }

function serverCmdCircleTest(%client)
   {
    for ( %a=5; %a < 50; %a+=4)
      {
       serverCmdMakeCircle(%client, %a, %a);
      }
   }

and it really only works properly when %r1 = %r2
to fix -- consult your math book and lookup the formula for the circumference of an ellipse, then adjust the forumla accordiingly.

the magic number here is 0.5 - the width of a 1x1 brick.

place a brick and type  /circletest to see it in action

54
Drama / Re: Red_Guy's Server
« on: September 21, 2011, 01:34:45 AM »
Interesting that it takes you 12 days to finally come and tell me something...

So I looked through my logs for Sept 7th and Sept 8th
nothing on sept 7th.

and on sept 8th I see this:

09/08/11 21:50:39 | World | Load stats | bl_id 21280 pick 612 $23500 HS 0 RS 0 Rank 0
-- he logs in

09/08/11 21:50:59 | Arkal | chat | WORLD hasn't been on in a while'
09/08/11 21:51:00 | Arkal | chat | :o
... time goes by
09/08/11 21:52:12 | World | Lotto | heatsuits | -1
... he mines a lotto block

09/08/11 21:55:45 | Arkal | chat | World
... time goes by

09/08/11 21:57:02 | Arkal | killed | GooG | 44476 16449
09/08/11 21:57:06 | Arkal | killed | World | 44476 612
09/08/11 21:58:21 | Arkal | chat | World.
09/08/11 21:58:27 | Swagbot | chat | World...
... more time goes by

09/08/11 22:00:43 | Swagbot | chat | World

09/08/11 22:02:48 | Swagbot | chat | World is a gay homo
09/08/11 22:02:52 | Arkal | chat | Not really allowed to do that..
09/08/11 22:02:53 | Swagbot | chat | World is a  gay homo

09/08/11 22:02:58 | Arkal | save stats | bl_id 20675 pick 44476 $29575 HS -3124 RS 35388 Rank 0
09/08/11 22:02:58 | Arkal | Leave Game |
09/08/11 22:02:59 | Swagbot | chat | World is a ga y homo
09/08/11 22:03:35 | World | save stats | bl_id 21280 pick 612 $23515 HS 0 RS 0 Rank 0
09/08/11 22:03:35 | World | Leave Game |


So you and swagbot annoyed him by killing and name calling... and then you bitch cause he "abuses" ?  maybe I should ban swagbot for a while due to language.

55
Modification Help / Re: (new problem) Save and Load (server sided)
« on: September 09, 2011, 03:50:47 AM »
add:
Code: [Select]
exec("config/server/clantags.cs");

to the END of your script.  Then it will load whatever is saved when you rsestart.

56
Off Topic / Re: Computer upgrade
« on: September 05, 2011, 03:40:28 AM »
Save your $150 and get a new PC lateron.  No amount of upgrading is going to help what you have.

Wait for christmas time when they have good deals, and ask your parents for some more $$, then you can get a real PC.

57
Modification Help / Re: Toggling A Mod
« on: September 05, 2011, 01:44:19 AM »
slightly simpler version.  Also with formatting fixed.

Code: [Select]
package AutoGreeter
  {
   function newChatHud_addLine(%text)
     {
      Parent::newChatHud_addLine(%text);

      if ($canGreet)
        {   
         //Called when any line of text is added to the chat box

         //This will turn the "jes00 connected." into "jes00"
         %nameToGreet = strReplace(%text," connected.","");

         //If the %nameToGreet variable is different to the original line greet them,
         //otherwise it's something else
         if (%nameToGreet !$= %text)
           {
            //Send a chat message saying hi to the player who joined (%nameToGreet)
            commandtoserver('messagesent',"Hi, " @ %nameToGreet);
           }
        }
     }
  };

activatePackage(AutoGreeter);


function ToggleGreet()
  {
   $canGreet = !$canGreet;

   if ($canGreet)
      clientCmdMessageBoxOK("Auto Greeter, by jes00","Auto Greeter is now: Off.");
   else
      clientCmdMessageBoxOK("Auto Greeter, by jes00","Auto Greeter is now: On.");
  }

$canGreet=true;


58
Modification Help / Re: Multi-Stage Scripting Contest
« on: August 12, 2011, 01:45:53 AM »
I wont be able to finish this
However, here is a save of a terrain I made a while back, but the code was not written in torqueScript.

http://www.mediafire.com/file/3ldpe2eqtynns97/Terrain_256.zip
its just over 42k bricks.

59
Help / Re: Dead Ping, Port Forwarding will not work!
« on: July 19, 2011, 02:58:45 AM »
some screenshots of stuff might help others see something your missing.

take one of blockland failing to work.
take one of running ipconfig /all at the command prompt.
take (several) of your network properties.

put them on a pic hosting site and post the links here.

60
Help / Re: Links do not work
« on: July 19, 2011, 02:51:11 AM »
the message "failed to open HKCR\http registry key!!!"  tells me the problem is outside of blockland.
changing up you key maps to whatever isnt going to help.
re-installing blockland probably wont help -- unless its in C:\program files\  and you install it to c:\games\   then there is a chance.

Try this:
find (or make) a html file, and put it somewhere.  then when you double-click on it, your internet browser (IE, Chrome, firefox, whatever)  should open.    My guess is that it will not open, and you will need to fix it.

how to make a html file depends on too many different things, so you will have to figure that out yourself.

Pages: 1 2 3 [4] 5 6 7 8 9 ... 19