CRPL related questions

Started by eduran, October 13, 2013, 09:10:10 AM

Previous topic - Next topic

kwinse

Quote from: Lost in Nowhere on November 07, 2013, 07:58:57 PM
Self "CONST_SUPPORTSDIGITALIS" FALSE SetUnitAttribute
Self "CONST_COUNTSFORVITORY" FALSE SetUnitAttribute
Self "CONST_SUPPORTSDIGIALIS" FALSE SetUnitAttribute

Haven't really picked through it but I noticed two typoed lines, one of them being a repeated command. Should be "CONST_COUNTSFORVICTORY".

Grayzzur

Quote from: Lost in Nowhere on November 07, 2013, 07:58:57 PM
Why does CRPL seem to not like me?
Anyways:
This is supposed to fire exploding globs of creeper that function similar to the Mass orbital weapons, but create more creeper.

In GremlinTower:
* You added the script "CRBullet.crpl" to your new bullet unit, instead of "GremlinBullet.crpl" like I think you intended.
* The next two lines, I think you need to fix the GetUnitAttribute parameters. Take the quotes off the consts
  ... <-v CONST_COORDX GetUnitAttributes ...
  ... <-v CONST_COORDY GetUnitAttributes ...

In GremlinBullet:
* What the previous poster mentioned. You misspelled some of the unit attribute constants. Also, they shouldn't have quotes around the constant names.
  Self CONST_SUPPORTDIGITALIS FALSE SetUnitAttribute
  - etc.

I recommend Notepad++ with the CRPL add-ons you can download from the Wiki. It really helps get the spelling of all the commands and constants correctly.
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

Lost in Nowhere

#32
I have Notepad++, but not the syntax highlighter thing... I guess I'll get that...
Aaaand, I can't find it.
Don't die! :)

Grayzzur

Quote from: Lost in Nowhere on November 08, 2013, 06:50:38 PM
I have Notepad++, but not the syntax highlighter thing... I guess I'll get that...
Aaaand, I can't find it.

http://knucklecracker.com/wiki/doku.php?id=crpl:overview

Bottom of the page, section called "Creating CRPL Scripts" -- has links to download config files for Notepad++, and tells you what to do with them.
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

Lost in Nowhere

#34
Quote from: Grayzzur on November 08, 2013, 11:01:20 PM
Quote from: Lost in Nowhere on November 08, 2013, 06:50:38 PM
I have Notepad++, but not the syntax highlighter thing... I guess I'll get that...
Aaaand, I can't find it.

http://knucklecracker.com/wiki/doku.php?id=crpl:overview

Bottom of the page, section called "Creating CRPL Scripts" -- has links to download config files for Notepad++, and tells you what to do with them.
Okay, now I just can't figure out how to get it to use it...
I have used all of the given instructions.
Edit - Never mind, it just doesn't apply to the files that are already open.
Don't die! :)

eduran

Is it possible to access the player's key bindings? I'd like to do something when the pause key is pressed. In principle, GetKeyDown does what I need, except that i don't know what key pause/unpause is bound to.

knucracker

There's no way to read those bindings right now...

Thinking about this, though, I wonder if an intrinsic function callback might meet the need.  For instance, if whenever the game was paused an "OnGamePaused" function would be called on any script.  The complication I can see is with the 'step' functionality (pressing 'n').  That basically allows a game to advance by one frame while in the paused state.  So even while paused, a game can advance.  Of course if you only want to do something at the moment of a pause, the callback would work fine (assuming it doesn't re-fire every time 'n' is pressed).

eduran

I am trying to use a couple of custom UI elements, which stop working during pause mode. What I need is a way to make sure they are left in a 'save' state when the game is paused. A OnGamePause function would work for that.

Lost in Nowhere

How would one make a "sandstorm" effect that covers the whole map, especially while paused?
Don't die! :)

eduran

Quote from: Lost in Nowhere on November 11, 2013, 08:57:55 PM
especially while paused?
CRPL scripts never run while the game is paused. The best one could do in that regard is set up a (still) image that shows during pause without any additional effect.

pawel345

#40
How does GetEnemyUnitsInRange work????? Because for some reason it counts my strafer and bombers as enemies?????????? also the code posted on the wiki as example doesn't work.....

Specifically I need a code to count all enemies on map on map. But the GetEnemyUnitsInRange counts also totems, ore deposits (but that's on I can simply subtract them). But out of random it also started including strafes and bombers ??? and that I can't take into account at first? bdw. still sitting on 1.04 build.

Grauniad

Ut-oh. Virgil made a recent change in how Strafers and Bombers are treated, to correct their ISLANDED attribute. I'll alert him to this and he may have to loo at a further fix. :)
A goodnight to all and to all a good night - Goodnight Moon

pawel345

I use the old build so it can't be that.

knucracker

Maybe the bomber itself counts, not the bomber pad.  The bomber and the bomber pad are actually two different 'units' to the game.  They are related internally, but are two distinct things nonetheless. So maybe the pad doesn't count, but the bomber does.  The part of your description the confuses me is this:
"But out of random it also started including strafes and bombers".

What do you mean by random?  Do you have a test map where they weren't being counted at some point, then they started being counted?

pawel345

Sorry I had a test map where the emitter output was scaled (max - number of enemies on map)*20 and it worked fine but when while testing i build a bomber and a strafer they started emitting AC(meaning nr. enemies on map has gone up) when i destroyed the bomber and strafer the emmiters behaved normally again. I used something like

0 ->count
0 0 99999 GetEnemiesInRange do
<-count add(1) ->count
enddo
<-count

this count included the ore deposits and totems on map as well.