are the parameters in the double-click menu on the core changeable via CRPL?
For example:
Creates Power Zone
Supports Digitalis
Counts for victory
Nullifier damages
no
Never mind, just found the commands that work to do this. (setunitattribute)
Although there is no command to take XY? I would have expected exponents to be included in CRPL...
I'll just have to write my own power script...
Unit attributes can do all those things, but not everything works all types of units (createpz doesn't work on player units, maxammo doesn't work on cores).
X^Y, use 'dup mul' for X^2, 'dup dup mul mul' = X^3, 'dup mul dup mul' = X^4... Just need an interesting way to do the in a do- or while-loop (remember there's a command 'rotate' which changes the order of three items on the stack (took a look at the docs and it's not listed))
I'll add a pow command. It is just an oversight that I didn't add that. Basically any math command available in .NET I can likely easily expose. So if you see something else, just let me know.
Quote from: virgilw on April 21, 2013, 09:40:17 AM
I'll add a pow command. It is just an oversight that I didn't add that. Basically any math command available in .NET I can likely easily expose. So if you see something else, just let me know.
1. square root
2. logarithms (particularly natural log, but if you could implement "(number) (base) log" as a command, that would be even better (although everyone who knows enough to be able to use logarithms will also know how to use change of base and so it's not a big deal))
3. you already have PI, but not euler's number (e), or the exponential function e
x (which with the power command are interchangeable)
P.S. Can someone fix those redlinks on the CRPL reference on the wiki
Quote from: thepenguin on April 21, 2013, 12:57:17 PM
Quote from: virgilw on April 21, 2013, 09:40:17 AM
I'll add a pow command. It is just an oversight that I didn't add that. Basically any math command available in .NET I can likely easily expose. So if you see something else, just let me know.
1. square root
2. logarithms (particularly natural log, but if you could implement "(number) (base) log" as a command, that would be even better (although everyone who knows enough to be able to use logarithms will also know how to use change of base and so it's not a big deal))
3. you already have PI, but not euler's number (e), or the exponential function ex (which with the power command are interchangeable)
P.S. Can someone fix those redlinks on the CRPL reference on the wiki
Those red links are because I've not written help pages for those links yet. I'll fill them in shortly (when I return to story missions and star sweeping over CRPL getting it ready for release).
Quote from: virgilw on April 21, 2013, 08:34:23 PM
Quote from: thepenguin on April 21, 2013, 12:57:17 PM
Quote from: virgilw on April 21, 2013, 09:40:17 AM
I'll add a pow command. It is just an oversight that I didn't add that. Basically any math command available in .NET I can likely easily expose. So if you see something else, just let me know.
1. square root
2. logarithms (particularly natural log, but if you could implement "(number) (base) log" as a command, that would be even better (although everyone who knows enough to be able to use logarithms will also know how to use change of base and so it's not a big deal))
3. you already have PI, but not euler's number (e), or the exponential function ex (which with the power command are interchangeable)
P.S. Can someone fix those redlinks on the CRPL reference on the wiki
Those red links are because I've not written help pages for those links yet. I'll fill them in shortly (when I return to story missions and star sweeping over CRPL getting it ready for release).
okay, I figured out what most of them do (arguments and results) just by trial and error.
You could also save off the first story mission, then create a project and put the save it in. That would extract out the scripts I wrote for that first story world. It uses those new CRPL commands to show the tutorial messages (that mission is why I had to add them).
Quote from: virgilw on April 22, 2013, 10:41:01 AM
You could also save off the first story mission, then create a project and put the save it in. That would extract out the scripts I wrote for that first story world. It uses those new CRPL commands to show the tutorial messages (that mission is why I had to add them).
I never knew that you could just extract scripts from maps like that... If I knew I probably would have grabbed a bunch of scripts from Aether instead of writing my own to do similar things. (although needing to do this for a map has introduced me to a lot of advanced CRPL that I needed a reason to learn)
also max, min, floor, and ceiling
and I have previously seen a random function that has a distribution based on a normal (bell-shaped) curve (given center and standard deviation) that could be used to create "realistic populations" of objects.
For a normal random distribution you can cheap out and simply add three uniform random values in the range of -1 to 1. You can also add 12 uniform random values in the range of 0 to 1, then subtract 6. There are fancier named things you can do, but here is a link to the most pragmatic site I could find:
http://www.protonfish.com/random.shtml
Quote from: virgilw on April 22, 2013, 07:31:53 PM
For a normal random distribution you can cheap out and simply add three uniform random values in the range of -1 to 1. You can also add 12 uniform random values in the range of 0 to 1, then subtract 6. There are fancier named things you can do, but here is a link to the most pragmatic site I could find:
http://www.protonfish.com/random.shtml
I heard about the adding of 3 numbers to make it work out, but never understood why it works (or how, for that matter), and so dismissed it as internet mythology...
also max, min, floor, and ceiling can be added in as custom software functions, so I guess there is little need for them builtin (though it would be nice and save some time...)
Quote from: thepenguin on April 22, 2013, 10:08:30 PM
Quote from: virgilw on April 22, 2013, 07:31:53 PM
For a normal random distribution you can cheap out and simply add three uniform random values in the range of -1 to 1. You can also add 12 uniform random values in the range of 0 to 1, then subtract 6. There are fancier named things you can do, but here is a link to the most pragmatic site I could find:
http://www.protonfish.com/random.shtml
I heard about the adding of 3 numbers to make it work out, but never understood why it works (or how, for that matter), and so dismissed it as internet mythology...
also max, min, floor, and ceiling can be added in as custom software functions, so I guess there is little need for them builtin (though it would be nice and save some time...)
I think things like adding the random numbers together would probably give a decent approximation of a normal distribution - but I don't see it as being possible to actually be equal to the normal distribution except *maybe* in a limit of adding infinite random numbers together (which is still completely impractical to actually use anyway).
The obvious way to disprove the adding 3 numbers between -1 and 1: A normal distribution would have some probability (albeit fairly small) of giving a value greater than 3, and it's impossible when adding those 3 numbers to get anything greater than 3.
Honestly, I'm not really sure why you would ever need to approximate the normal distribution in code anyway for CW3.
I'd only every used the "add 12 numbers then substract 6" method. The add 3 (in the range of -1 to 1) sounds like a hatchet job approximation.
http://dualibra.com/wp-content/uploads/2011/10/Numerical_Methods_of_Statistics__Cambridge_Series_in_Statistical_and_Probabilistic_Mathematics_.pdf
Bottom of page 309. This describes the other better techniques, with Box-Muller being the one you find on most web sites.
But, like you say, there aren't too many times you would need to do this in a custom map (unless you are making a function or histogram plotter using walls on a flat map :) )
I really will be interested to see what map ThePenguin produces with all the requests he's made here.
Quote from: Grauniad on April 26, 2013, 10:28:23 AM
I really will be interested to see what map ThePenguin produces with all the requests he's made here.
You're not the only one...
Is it possible to download the crpl reference wiki pages? Then I can code stuff without internet (still can't test without internet until CW3 is released)
The best you can do is download the html pages one at a time, or with a crawler. I forget which ones are any good, but in the past I've download a 'site' to local html files before. I'd give you the html files on the server... if there were any. What is on the server is in wiki syntax and gets rendered to html whenever a page is viewed.
Quote from: J on April 26, 2013, 10:37:08 AM
Quote from: Grauniad on April 26, 2013, 10:28:23 AM
I really will be interested to see what map ThePenguin produces with all the requests he's made here.
You're not the only one...
Is it possible to download the crpl reference wiki pages? Then I can code stuff without internet (still can't test without internet until CW3 is released)
Quote from: Grauniad on April 26, 2013, 10:28:23 AM
I really will be interested to see what map ThePenguin produces with all the requests he's made here.
I'm almost ready for release of the map, it should be out before monday, if all goes well with my fine-tuning the endgame.
Current Map Name is
Troublesome Trains 1: Tutorial (**Mission Name Suffix subject to changes**)
It's something significantly different from most of the other maps that have been produced, in terms of mission objectives.