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.

Topics - Xalos

Pages: [1] 2 3 4 5 6 ... 17
This library is mainly intended as a proof of concept to demonstrate that the .dso file format can be used to perform tasks that would be slow, cumbersome, or impossible with pure TorqueScript code.

GVarAccess.cs.dso implements two functions: getGlobalVar(%name) and setGlobalVar(%name, %value). They can be used like so:
Code: [Select]
==>$test = "Hello World!";
Hello World!
==>setGlobalVar("$value", "text");
To execute the file, call exec("./GVarAccess.cs"); as with any other script file.

While getGlobalVar and setGlobalVar are not vulnerable to injection exploits like a naive eval-based implementation, they are capable of reading and writing any global variable.  Use appropriate caution about using untrusted inputs in calls to these functions.

Using .dso here is not intended for obfuscation.  As such, I've also included a text file which breaks down the GVarAccess.cs.dso binary.
Torque 3D has been publicly available under the MIT license for eight years now, so this doesn't reveal anything which could reasonably be considered secret. download

Modification Help / getFullDateTime() - returns MM/DD/YYYY hh:mm:ss
« on: May 14, 2020, 09:09:32 AM »
getDateTime() only returns two year digits, meaning it will not work if you happen to be a time traveller from 1920 or 2120.

If you need the full year, this is the function you need.

Code: [Select]
// returns the date and time, with the full current year
function getFullDateTime()
// get the current date and time from getDateTime
%value = getDateTime();
%date = getWord(%value, 0);

// if the date has changed, or the date has never been set, get the current century by creating a temporary file
if ($CurrDate $= "" || $CurrDate !$= %date)
$CurrDate = %date;
%file = new FileObject();
$CurrCentury = getSubStr(getFileModifiedSortTime("base/temp/temp.txt"), 0, 2) + 19;

// replace the year in the date with the full year
%date = strReplace(%date, "/", " ");
%date = setWord(%date, 2, $CurrCentury * 100 + getWord(%date, 2));

// return the full date and time
return strReplace(%date, " ", "/") SPC getWord(%value,1);

Known issues:
Does not work if the current year is before 1900. If you're time travelling from 1899 or before, you're out of luck.
Does not work if the function is called on the same day of the year, 100 years apart.
Does not work if the file base/temp/temp.txt exists, is read-only, and has a last modified date in a different century.

General Discussion / Open Code Server (hosted as Open Code's Server)
« on: April 30, 2018, 01:31:06 PM »
I am hosting Open Code once again!

The server is being hosted under an alternate key, named Open Code.

    What does "Open Code" mean?
The concept of an open-code server is something I had bouncing around long before I actually started hosting it.  Essentially, the idea is that everyone has near-unlimited access to the console, via eval - anyone can run basically any code.  Certain functions are blocked, such as crash() and quit().

    So the server is stable, right?
Not even close.  Just because I've blocked as many of the trivially-obvious methods of crashing as I can doesn't mean the server is in any way stable.  We're constantly finding new and bizarre ways to break the server, the game, and even TorqueScript itself.  Don't build anything you can't bear to lose here!

    My eval showed up as yellow/red/dark red!  What does this mean?
Yellow means that there's an error that the (unfinished) validity checker didn't realize existed until the end of the code.  This usually means you have an unclosed string or block pair.  Completely red means the code passed the validity checker but was still invalid; partially red means there's a syntax error where the red portion begins.  Dark red means that the code passed the validity checker but was never run; this only happens if there is some code which is not allowed, such as crash(), quit(), echo(), etc.

    Why is [insert piece of code here] blocked?  Unblock it!
Some portion of the code is inherently malicious - this includes things like crash and quit (obvious), echo (can crash the server and only useful for spamming the console), and trying to define a function with the name servercmdEval (would overwrite the existing /eval command).

    I accidentally crashed the server!  Am I going to be banned?
No.  It's my job to try to make the server as stable as possible, not to hide the instabilities from those who might exploit them.  An brown townogous situation would be antivirus software - they don't have the luxury of banning specific people from writing code; they have to instead flag the code as malicious based on the code itself.

    Did you ever fix chat overwrites breaking eval?
Yep; chat can still be overwritten, but anything prefixed with + will be run as eval, regardless what happens to the server chat.

    What are some examples of code that I could run?
+%hit.addVelocity("0 0 200");    Sends whatever you're looking at flying upwards!
+%obj.setPlayerScale(5);    Makes your player really large!

    Media from the Depths of Hell
The Soundscape of Open Code
Open Code: The Movie
Open Code - Spinning Around

Come make craziness and insanity happen!

Credits to Ipqarx for having no life finding probably all the default functions which expose eval in an exploitable manner!

If you have a line of code that you'd like me to add to the example list, feel free to post it!

Game Modes / Blender
« on: July 04, 2017, 12:55:24 PM »
Blender, as seen in this thread.

If you want to use this in part or in whole for your server, add-on, video, or whatever, or edit it and make your own version, feel free.

Modification Help / [Library] SHA-256
« on: March 19, 2017, 09:33:52 AM »
In light of a SHA-1 collision being found in practice, Blockland no longer has any default functions capable of providing even the slightest glimmer of cryptographic security.  So I decided to write SHA-256 in TorqueScript.

This library was written using pseudocode from the Wikipedia page on SHA-2, an addition function by Port, and test vectors for several SHA variants from DI Management.

The function in this library operates much in the same way as the default sha1 function, taking a string and returning the hash of that string in hexadecimal.  It should work on any string that does not overflow the TorqueScript string buffer, but as it is written in TorqueScript it may hang Blockland for noticeable periods of time for very long strings.

Please note that unless you are writing code where the cryptographic properties of SHA-256 are important, you should probably stick to using the default sha1 function, which is much faster than any hashing function written in TorqueScript.

Benchmark comparisons:
Running sha1("") 999999 times: 2400 ms, or ~2.4 s per call
Running sha256("") 9999 times: 124736 ms, or ~12.5 ms per call

Add-Ons / Xalos Add-On Rerelease Pack
« on: October 31, 2016, 10:49:38 AM »
I recently noticed that Google Drive has deprecated the format I was using for direct linking.  As such, all images, sounds, add-ons, and other files I have linked to there no longer work, including almost all of my released add-ons.

Thus, I decided to make a comprehensive archive of all the add-ons I have released previously, and many I have not.  Be aware that many of the mods which were not released, were not released due to stability or usability concerns.  It is unwise to simply drop all of these into your add-ons folder and enable all of them, as any number of conflicts may occur, both within the mods in the archive and with other mods.

The very popular Planets mod ( and the Stargate mod (, enable as normal under Custom rather than running as a gamemode) are both included in this archive, which had not been released prior to now.  Also included is the Planets gravitation helper and its source code.  Run this before starting a Planets server and, in theory, it will allow the server to run much more smoothly than the native TorqueScript version of the code.  In practice, some retrying might be needed to get it to work correctly.

Feel free to modify, expand, and redistribute any or all of the mods.

Off Topic / Xalos gained a level!
« on: March 08, 2016, 04:31:44 PM »
Xalos has reached 366/366 EXP and levelled up to Level 21!

Wait, I already did this joke.

I can now do things such as legally drink alcohol and play Blockland at max shaders at 90 FPS!

I probably won't do the former, but I'm definitely going to be doing the latter.

Forum Games / Forum Cryptography
« on: February 16, 2016, 06:00:30 PM »
I've made a cipher.  This is not a cipher I would use for encrypting my bank credentials, but it should be interesting to see if you guys can crack it!

The ciphertext you're trying to break is this:

Old ciphertext, use the one on page 2.

Code: (Ciphertext) [Select]

If you want to know the ciphertext for a chosen plaintext, post it in [code][/code] or [tt][/tt] tags and I'll reply with the ciphertext!

EDIT: Restored all the old ciphertexts, and put the V2 ones on page 2.  Ignore all the ciphertexts on page 1.

I'm trying to find a to detect when a BrickDeployProjectile is deleted due to its lifetime expiring, rather than from hitting an object.  How might I detect this?

Add-Ons / Gravity Gun
« on: December 15, 2015, 02:49:48 AM »
At long last, I have completed the new Gravity Gun!

"You can call it the Zero Point Energy Field Manipulator, if you really want to."

The controls are identical to the Half-Life 2 Gravity Gun, so I'll let Alyx Vance explain.
"The primary trigger emits a charge.  You can punt stuff and send it flying.
The secondary trigger (jet key) lets you grab things.  You can throw them with the primary.
Once you've picked something up, you can drop it gently by pressing your secondary trigger again.
You can also pull stuff over from a distance."

As in Half-Life 2, it's not necessary to continue holding down the secondary trigger once you've picked an object up.
This seems to confuse a lot of people initially, so I'm stating it here for clarity.

In addition to the Gravity Gun, you also get some complementary Half-Life 2 objects: the barrels, propane tank, and sawblade!

Modelling Credits:
  • Mr.Noody [6480] - Gravity Gun & Gravity Gun (Charged) models and icons, CI icons
  • Carbon Zypher [2213] - Brick, Sawblade, Propane Tank, and Barrel models

>>> Download <<<

General Discussion / Gravity Gun Deathmatch
« on: December 11, 2015, 11:51:04 PM »
It's raining saws over in Bricktown DM, and only you can save the townspeople use the saws to strike down your foes!

Use your Gravity Gun to grab saws and fling them at other people!

Gravity Gun controls:
Primary Trigger: Punt objects, or launch held objects!
Secondary Trigger: Attract objects, grab objects once in range, drop held objects!

If you can't hear the sounds when you join, I recommend restarting Blockland and rejoining the server.

Game Modes / Solar Apocalypse
« on: October 03, 2015, 04:01:02 AM »
During the night, you try to gather materials.  During the day, you hide from the sun.
This version fixes the sun not moving across the sky correctly.

Download Solar Apocalypse

Suggestions & Requests / Looking for Stargate Dial Failure Sound
« on: June 09, 2015, 01:05:26 AM »
I've been trying to find the (Milky Way) Stargate dial failure sound, without any other sounds on top of it.  If anyone could help me out here, I'd appreciate it greatly.

Modification Help / Projectile Piercing
« on: May 18, 2015, 05:02:31 PM »
I didn't really feel like releasing this as an add-on, so here it is if you want to use it for your own purposes.

Code: [Select]
package WeaponPiercing
function ProjectileData::onCollision(%data, %proj, %col, %one, %hitPos, %hitNorm, %hitVel)
Parent::onCollision(%data, %proj, %col, %one, %hitPos, %hitNorm, %hitVel);
if(isObject(%exp = %data.explosion) && %exp.damageRadius != 0) return;
if(%col.getType() & $Typemasks::PlayerObjectType) return;
if(%col.getName() $= "GroundPlane") return;
%normVel = vectorNormalize(%hitVel);
%box = %col.getWorldBox();
//Run through each of the three axes - east, north, and up.
//Get the speed of the projectile on the current axis
%value = getWord(%hitVel, %i);
//The projectile isn't moving on this axis; it'll never exit this way.
if(%value == 0) { %len[%i] = 999999; continue; }
//We're moving in the negative direction; get the lower box coordinate
else if(%value < 0) %exit = getWord(%box, %i);
//If neither of the above are true, we must be moving in the positive direction
else %exit = getWord(%box, %i + 3);
//Get the distance to travel on the current axis,
%dist = %exit - getWord(%hitPos, %i);
//and do some math to turn that into the overall distance.
%len[%i] = vectorLen(vectorScale(%normVel, %dist / getWord(%normVel, %i)));
%exitLen = getMin(getMin(%len0, %len1), %len2);
%exitPos = vectorAdd(%hitPos, vectorScale(vectorNormalize(%hitVel), %exitLen));
if((%pierce = %data.maxPierceDepth) $= "") %pierce = %data.directDamage * %data.muzzleVelocity / 5000;
if(%proj.piercedDist + %exitLen < %pierce)
%data.schedule((%exitLen / vectorLen(%hitVel)) * 1000, "spawnPiercingProjectile", %proj.client, %exitPos, %hitVel, %proj.piercedDist + %exitLen);
if(isObject(%data.stickExplosion)) %proj.delete();

function ProjectileData::spawnPiercingProjectile(%data, %cl, %pos, %vel, %piercedDist)
%newProj = new Projectile()
client = %cl;
datablock = %data;
initialPosition = %pos;
initialVelocity = %vel;
piercedDist = %piercedDist;

Modification Help / Our knowledge of mathematics is a lie!
« on: May 17, 2015, 01:40:09 PM »
Fellow Blocklanders - as you no doubt know, all numbers have a maximum precision of six decimal digits.  All attempts to calculate values beyond this cosmic limit are doomed to failure.  This is the basis of all mathematics, and we have based our entire society on this well-known maximum limit.  Some fools have dared to go beyond this limit, but they were derisively dismissed as lunatics with no regard for the natural order of things.

But it is all a lie!  The underlying fabric of reality we all live within allows a maximum of up to sixteen decimal digits of precision!  Our entire knowledge of mathematics is a baseless lie!  We have been following arbitrary limits imposed by an unseen force!

All jokes aside, TorqueScript implements double-precision floating-point mathematics in the underlying engine code; the full precision is simply truncated to six decimal digits when converting to a string or crossing function calls.  Try the following code snippets in the console - the "Expected Result (6 digits)" is what we'd expect to get if the numbers were truncated to 6 digits before being passed into mathematical operands.

Code ExampleExpected Result (6 digits)   Expected Result (Single)   Expected Result (Double)
echo(mPow(2,1023));8.98847e+307Positive Infinity8.98846567...*10307
echo((mPow(2,127)+mPow(2,125))-2.12676e+38);   04.867778...*10324.79325586...*1032
echo(1/3-0.333333); //Ipqarx03.476938...*10-73.33333333...*10-7

So now the only question remaining is how to utilize the full precision of the underlying doubles without being truncated to six decimal digits.

Pages: [1] 2 3 4 5 6 ... 17