Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Clean0nion on April 15, 2014, 05:34:49 PM

Title: GetDeepestCreeperCell
Post by: Clean0nion on April 15, 2014, 05:34:49 PM
No page on the wiki for GetDeepestCreeperCell. Does anyone know the arguments and notation for this?
Thank you!
Title: Re: GetDeepestCreeperCell
Post by: Grayzzur on April 15, 2014, 06:42:33 PM
This is intended to sort of show you how to go about figuring that out on your own, while waiting for a response from Virgil or someone else who actually knows.

Experimental discovery of undocumented commands:

On a map with stuff relevant to the task at hand (in this case, probably an emitter so there's some creeper), put a CRPL core with something like this:


once
ShowTraceLog
ClearTraceLog

GetAllUnitsInRange
TraceStack
endonce



I show this one first, as it requires arguments. If you run it, the trace window will say something like:
WARNING: Taking item from an empty stack: GETALLUNITSINRANGE at line 11
It repeats that message 4 times. GetAllUnitsInRange requires 4 arguments. There's a starting point.

If you do the same thing with GetDeepestCreeperCell, it does not complain about any arguments at all, so it does not require any. After running it, TraceStack reveals that there are now 2 numbers on the stack (in my case, 20 and 21, approximately the cell where I had the most creeper). So, I'd guess it's pushing the X/Y values of the deepest cell on the whole map w/o requiring any arguments.


Title: Re: GetDeepestCreeperCell
Post by: knucracker on April 16, 2014, 09:09:25 AM
Yep, that is exactly what it does.  If there is no creeper on the map I believe -1 and -1 are pushed to the stack.
Title: Re: GetDeepestCreeperCell
Post by: Clean0nion on April 16, 2014, 09:24:53 AM
Thank you! And thanks Grayzzur for that technique!
Title: Re: GetDeepestCreeperCell
Post by: driesemol on August 20, 2015, 06:21:31 PM
The wiki page says that this can also be used for mortar-like aiming, but since this only gives the position of the deepest creeper in the whole map, how can you use this to get the deepest creeper cell in range?
Title: Re: GetDeepestCreeperCell
Post by: warren on August 21, 2015, 09:17:59 AM
That is a good point. I would say the wiki is wrong. I do know that for simulating blasters you use the much more complicated GetNearestGroundEnemy (http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getnearestgroundenemy). For mortars I suspect there is no alternative but to do a double loop containing getCreeper (http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getcreeper) and a range check.
Title: Re: GetDeepestCreeperCell
Post by: driesemol on August 21, 2015, 04:06:14 PM
as i said i'm not experienced yet... can you give me an example of how to do it exactly?