Precompiler

View previous topic View next topic Go down

Precompiler

Post by DanielLC on Sat Nov 20, 2010 6:26 pm

I coded this a while back. It has two basic functions:

#FOR <name> <number><space><body>#NEXT
This writes <body> <number> times, each time with <name> replaced with a number from zero to <number>-1. I wrote out <space> because you have to have a space there. A newline won't work.

#MODULE[<variable1>,<variable2>,...,<variablen>]
This uses a module (which has to be saved separately) with each variable in it replaced with whatever text you wrote. Don't put spaces by the commas. The variables don't have to actually contain any text, so if you want to negate something half the time, you can make a variable that is either "" or "-" (no quotes). They can't contain commas or right brackets, but anything else is fair game.

To save the module, put the module name in the upper left, the variables in the upper right, and the body in the text area. Again, no commas between the variables. Don't precompile before saving it. It won't hurt, but it will make it so it has to save the longer version.

If you want to, you can make the name of another module a variable, so you can easily control what module attaches to a given module. You can even make a module use itself, so long as you do something to keep it from recursing forever. Right now, I think that limits it to putting it in a #FOR loop and setting the number of iterations in the module as a variable.

I'm considering adding something for temporary modules that are defined in the text you're precompiling, and something for arbitrary javascript code.

The purpose of the #MODULE command is to make it so you could have, for example, a gun that you can easily use on multiple modules. You could even go so far as to have several frames, guns, etc. defined, and use one command to fuse them all together.

Does anyone know how I can put this on the internet to make it easier to use? Right now, you have to save it as an .html file, and open it with a browser.

[code:1:63c1]<html>
<body>

<script type="text/javascript">
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document

DanielLC
Tank
Tank

Posts : 78
Join date : 2010-10-23

View user profile

Back to top Go down

Re: Precompiler

Post by JHaskly on Sat Nov 20, 2010 7:10 pm

Hmm. Is this basically a way to write models with the advent of loops and modules?

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Precompiler

Post by DanielLC on Sun Nov 21, 2010 12:14 am

Yeah.

DanielLC
Tank
Tank

Posts : 78
Join date : 2010-10-23

View user profile

Back to top Go down

Re: Precompiler

Post by JHaskly on Sun Nov 21, 2010 1:01 am

Nice. I made something like this a while back (in Lua), but I never really finished it/forgot about it.

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Precompiler

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum