Author Topic: [CHALLENGE] Rosetta Code - "Tasks not implemented in torquescript"  (Read 3545 times)

I actually just looked at the full torque 3d torquescript reference, fileDelete is a default function.
Ok, it must just be fileCopy then. I know he added something.

Ok, it must just be fileCopy then. I know he added something.
No, that's there too.
Badspot has either removed a lot of stuff, or the version of t3d that bl runs on is just too old.
There's also a crapload of other file stuff, including full support for zip files.

Badspot has either removed a lot of stuff, or the version of t3d that bl runs on is just too old.
There's also a crapload of other file stuff, including full support for zip files.

That's because we are on TGE 1.3 (modded), not T3D.

discoverFile was the one he added.

That's because we are on TGE 1.3 (modded), not T3D.
Sorry, that's what I meant.

And also I'm sorry elm but there is a much better way to do rot13 and I will be putting that in very soon.

Edit: I will also be adding in the ceaser cipher tomorrow as well.
« Last Edit: June 18, 2012, 10:01:18 PM by Ipquarx »

Sorry, that's what I meant.

And also I'm sorry elm but there is a much better way to do rot13 and I will be putting that in very soon.

Edit: I will also be adding in the ceaser cipher tomorrow as well.

Haha alright.


It's ok haha.

Also, added the function benchmarking one: http://rosettacode.org/wiki/Time_a_function#TorqueScript
Very nice.

I think I'm going to do some hardcore coding for gettng a whole crapload of these done.

These aren't natural.
They're allowed to be user-implemented.. look at the other languages.

Here's a CSV to HTML converter, uses tables :)

http://rosettacode.org/wiki/CSV_to_HTML_translation

Code: [Select]
//csv2html(inputFilePath, outputFilePath, INT size of border for table, INT size of cellpadding for table);
function csv2html(%input, %output, %border, %padding)
{
%f = new fileObject(); //Create a file object
if(!isFile(%input)) //Check if the input exists
{
error("Error 404, could not find input file:" SPC %input);
return;
}
if(!isWriteableFile(%output)) //Check if we can create the output
{
error("Cannot write to file:" SPC %output);
return;
}
if(fileExt(%input) !$= "csv" || (fileExt(%output) !$= "html" && fileExt(%output) !$= "htm")) //Check if we're using the right extension
{
error("Invalid file extension. Try: csv for the input file, and htm or html for the output.");
return;
}
%f.openforRead(%input); //read the input
while(!%f.isEOF()) //process the input
%workingFile = %f.readLine();
%f.close(); //close and delete the file object
%workingFile = strReplace(%workingFile, ",", "</td><td>"); //process the data
%workingFile = strReplace(%workingFile, "\r\n", "</td></tr>\r\n<tr><td>"); //more processing
%f.openForWrite(%output); //using our original file object
// %f.writeLine("<html><title>Converted from CSV</title><body>"); //pretty title for a full page, you can uncomment this if you'd like.
%f.writeLine("<table" SPC ((%border > 0) ? "border =" SPC %border SPC "" : "") @ ((%padding > 0) ? "cellPadding =" SPC %padding : "")); //fancy ternary operators for determining border size
%f.writeLine(%workingFile); //write the processed file
%f.writeLine("</table></body></html>"); //close the html thingies
%f.close(); //close file object
%f.delete(); //delete file object
}

outputs this:
Code: [Select]
<table>
<tr><td>Character</td><td>Speech</td></tr>
<tr><td>The multitude</td><td>The messiah! Show us the messiah!</td></tr>
<tr><td>Brians mother</td><td>&lt;angry&gt;Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!&lt;/angry&gt;</td></tr>
<tr><td>The multitude</td><td>Who are you?</td></tr>
<tr><td>Brians mother</td><td>I'm his mother; that's who!</td></tr>
<tr><td>The multitude</td><td>Behold his mother! Behold his mother!</td></tr>
</table>

I believe.
« Last Edit: June 20, 2012, 03:04:23 PM by Lugnut »

I'm surprised I'm the only one in Torquescript Users.
I thought there would be more people.

Anyway, i'm going to to a bunch more of these today, including the 24 game.




how do you add yourself :(
Here's a snippet from my user page, which contains a mylang table. This adds you to the languages you specify, and you can indicate how proficient you are at those languages.

My language table:
Code: [Select]
{{mylangbegin}}
{{mylang|TorqueScript|Advanced}}
{{mylang|C#| Proficient}}
{{mylang|C++|Interested Beginner}}
{{mylang|Java|Currently Learning}}
{{mylang|PHP|Intermediate}}
{{mylang|JavaScript| Proficient}}
{{mylang|MySQL|Interested Beginner}}
{{mylang|Scheme|Intermediate}}
{{mylang|Scratch|Advanced}}
{{mylang|TI-83 Basic|Intermediate}}
{{mylangend}}

EDIT: Finished the 24 game :)
« Last Edit: June 24, 2012, 04:28:42 PM by Ipquarx »