Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Grauniad on October 25, 2013, 09:57:33 AM

Title: Missing CRPL commands
Post by: Grauniad on October 25, 2013, 09:57:33 AM
Update:

Today, 2/2/2014, I obtained a new list from Virgil containing all CRPL commands. I created an auto-reference list and placed it in the wiki (http://knucklecracker.com/wiki/doku.php?id=crpl:missing). All missing commands now appear in red in that list. If you add a command, then it will not show in red, but in green. If Virgil adds more commands, we can but hope he'll at least add it to this list. :)

Previously, Virgil said this about any work done on the command reference:
QuoteNow some of these you may not know what they are, so just leave them.  Others, it may not be clear what section to stick them in.  And some will probably be clear.  Any of them that you get added will be that much less I have to sort out, so thanks in advance.

Again: Missing CRPL command List (http://knucklecracker.com/wiki/doku.php?id=crpl:missing)





Now some of these you may not know what they are, so just leave them.  Others, it may not be clear what section to stick them in.  And some will probably be clear.  Any of them that you get added will be that much less I have to sort out, so thanks in advance.

FailMission
GetTargetOffsetX, GetTargetOffsetY, SetTargetOffsetX, SetTargetOffsetY
SetPopupText, SetPopupTextX, SetPopupTextY, SetPopupTextAlwaysVisible
PauseGame UnpauseGame,
GetGameTimeFrames
SetScripVar and GetScriptVar for built in units.
GetNearestGroundEnemy
SetCreeperMax, SetAntiCreeperMax
ShowMessageDialog, IsMessageDialogShowing
GetUnitTransformPosition
SetCreeperColors,GetCreeperColors
SetTerrainOverride, GetTerrainOverride
SetScreenMode, SetScreenCoords, SetScreenCoordX, SetScreenCoordY, SetScreenPixelCoords, SetScreenPixelCoordX, SetScreenPixelCoordY,
CreateListStartingSize, AppendStackToList, PrependStackToList
NotPersist
SetText, SetTextColor, SetTextSize, SetTextX, SetTextY, SetTextAnchor
GetScore, SetAdditionalScore, GetAdditionalScore, AddAdditionalScore
ToUpper, ToLower
StackSize


Now constants to add to the GetUnitAttribute page
CONST_SHOWHEALTHBAR, CONST_SHOWAMMOBAR, _CONST_SHOWAMMOACBAR



To tell what button is pressed on a message dialog.

In your script you need to add an intrinsic function called.
:ShowMessageDialogCallback

That function will get called whenever a message dialog is closed.  When it is called, an int is present on the stack that indicates which button.  0 means OK and 1 means cancel.

So this should work in a script.

:ShowMessageDialogCallback
  ->result
  trace2("Button: " <-result)


[/s]
Title: Re: Missing CRPL commands
Post by: ThirdParty on October 25, 2013, 05:17:07 PM
How about unit types?  For example, one of the code examples has a ' "TOTEM" CurrentCoords CreateUnit ' command, but TOTEM isn't listed as a valid unit type on the pages for CreateUnit and GetUnitType.

Quote from: Grauniad on October 25, 2013, 09:57:33 AMAny of them that you get added will be that much less I have to sort out, so thanks in advance.
The wiki doesn't allow ordinary users to create pages, so unless you at least create a blank page for each command, there's exactly zero chance that some user will figure out how it works and create documentation for it.
Title: Re: Missing CRPL commands
Post by: thepenguin on October 25, 2013, 06:46:20 PM
Quote from: ThirdParty on October 25, 2013, 05:17:07 PM
The wiki doesn't allow ordinary users to create pages, so unless you at least create a blank page for each command, there's exactly zero chance that some user will figure out how it works and create documentation for it.
I'll take care of some blanks for everyone.
Title: Re: Missing CRPL commands
Post by: Grauniad on October 25, 2013, 06:57:37 PM
Quote from: ThirdParty on October 25, 2013, 05:17:07 PM
The wiki doesn't allow ordinary users to create pages,

For those able to contribute, let me know (post here or PM) and I can elevate them to the esteemed position of "editor" who can create pages in the wiki.  Eventually we'll lift the restriction, but consider the wiki in an extended beta  mode for now.
Title: Re: Missing CRPL commands
Post by: ThirdParty on October 25, 2013, 07:39:58 PM
Quote from: Grauniad on October 25, 2013, 06:57:37 PMFor those able to contribute, let me know (post here or PM) and I can elevate them to the esteemed position of "editor" who can create pages in the wiki.  Eventually we'll lift the restriction, but consider the wiki in an extended beta  mode for now.
I'm willing to help, at least a little.  I'm trying to learn CRPL anyway, I'd might as well be adding documentation as I figure things out.
Title: Re: Missing CRPL commands
Post by: Grauniad on October 25, 2013, 08:54:08 PM
If you log in/out here and in the Wiki, you should be able to create pages now.
Title: Re: Missing CRPL commands
Post by: ThirdParty on October 26, 2013, 01:41:52 AM
Quote from: Grauniad on October 25, 2013, 08:54:08 PMIf you log in/out here and in the Wiki, you should be able to create pages now.
Thanks!

I've skimmed through all the main story mission looking for undocumented commands, and listed them on the CRPL Reference (http://knucklecracker.com/wiki/doku.php?id=crpl:crplreference) page.  (Many of them are still undocumented, but at least people will know that they exist.)  The best find was "GetAllUnitsInRange", which will greatly simplify a map I've been thinking about doing.

I suspect that there are still some missing commands.  For example, there ought to be a way to create an air exclusion field around a CRPL tower, but it's undocumented.
Title: Re: Missing CRPL commands
Post by: jsmith45 on October 26, 2013, 04:34:53 PM
I've gone ahead and added all the remaining undocumented commands to the CRPL Reference page.

I put a few in the Utility sections when I had trouble figuring out where they would best go.

Some of the interesting commands now listed (but not documented) include : "DropFromOrbit", "AscendToOrbit", "DestroyAllEnemyUnits", "CreateIndicatorArrows", "GetCurrentBuildTab" (the last two being used in the tutorial missions to guide the player), "SetTechArtifactType", and "EnableAlternateControlMode" (hides the normal build panels, used in the credits mission, among other places).

I also added the remaining two special special :functions that can get called automatically by the game.
Title: Re: Missing CRPL commands
Post by: Clean0nion on December 09, 2013, 12:47:27 PM
I don't have user permission to create these pages. All the needed code is here.

SETSYSTEMINHIBITED (utility)

Spoiler
~~DISCUSSION~~
<- [[crpl:crplreference|CRPL reference]] <- [[crpl:crplreference#utility_commands|Utility Commands]]
=====  SetSystemInhibited  =====

^Arguments^Result^Notation^
| Boolean |None | n1 -- |

=== Description ===
Sets whether or not the next star system is unreachable. Only used in Arc Eternal; do not use in custom CRPL units.
=== Examples ===
<code>
SetSystemInhibited (FALSE)
</code>
[close]

SHOWCONVERSATION (conversation)

Spoiler
~~DISCUSSION~~
<- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#conversation_commands|Conversation Commands]]
=====  AddConversationMessage  =====

^Arguments^Result^Notation^
|None|None| -- |

=== Description ===

Opens the current conversation.

=== Examples ===
<code>
ClearConversation
0 "Where am I?" AddConversationMessage
1 "You're on a planet!" AddConversationMessage
ShowConversation
PauseGame
</code>
[close]

ASCENDTOORBIT (unit)

Spoiler
~~DISCUSSION~~
<- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]]
=====  DropFromOrbit  =====

^ Arguments ^ Result ^ Notation ^
|None|None| - |

=== Description ===

The unit rises from its current coordinates and ascends to orbit. This creates exactly the same effect that sending a CN to orbit does. Once the unit is ascended it counts as destroyed, as in it is no longer on the map, but it can be recovered by pushing DropFromOrbit.

<code>
"Bye bye!" SetText
AscendToOrbit
</code>
[close]

CURRENTPIXELCOORDS (unit)

Spoiler
~~DISCUSSION~~
<- [[crpl:crplreference|CRPL reference]] <- [[crpl:crplreference#utility_commands|Utility Commands]]
=====  CurrentPixelCoords  =====

^Arguments^Result^Notation^
| |Pixel X and Y coords of unit |''-- X1 Y1 ''|


=== Description ===
Pushes the current unit's X coordinate and Y coordinate in floating point pixel space to the stack.
=== Examples ===
<code>CurrentPixelCoords trace2</code>

[close]
Title: Re: Missing CRPL commands
Post by: Grayzzur on December 09, 2013, 12:56:20 PM
Quote from: Clean0nion on December 09, 2013, 12:47:27 PM
I don't have user permission to create these pages. All the needed code is here.
Added. I took a quick proofread pass, but if they're not perfect, you should be able to edit them now that they exist.
Title: Re: Missing CRPL commands
Post by: Grauniad on December 09, 2013, 01:11:49 PM
Quote from: Clean0nion on December 09, 2013, 12:47:27 PM
I don't have user permission to create these pages. All the needed code is here.

You should now have permission. Log in/out, both here and in the wiki if you don't yet see the elevated privilege.
Title: Re: Missing CRPL commands
Post by: stewbasic on January 19, 2014, 11:12:17 AM
If it's not too much trouble, could I also have create page permission? I'm not sure how much editing I'll have time for, but I should be able to fill in a couple of functions at least.
Title: Re: Missing CRPL commands
Post by: Grauniad on January 19, 2014, 11:16:34 AM
Done.
Title: Re: Missing CRPL commands
Post by: Grauniad on February 03, 2014, 11:29:47 AM
top post updated with this link: http://knucklecracker.com/wiki/doku.php?id=crpl:missing
Title: Re: Missing CRPL commands
Post by: kai on February 03, 2014, 11:46:45 AM
Nice to see the update of ref wiki.
And I found some interesting things in the syntax highlighting, which is not in any part of wiki :D :
CONST_GETATTRIBUTE
CONST_SETATTRIBUTE

Title: Re: Missing CRPL commands
Post by: Grauniad on February 03, 2014, 11:50:26 AM
Quote from: kai on February 03, 2014, 11:46:45 AM
Nice to see the update of ref wiki.
And I found some interesting things in the syntax highlighting, which is not in any part of wiki :D :
CONST_GETATTRIBUTE
CONST_SETATTRIBUTE



http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getunitattribute
http://knucklecracker.com/wiki/doku.php?id=crpl:docs:setunitattribute

http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getunitattribute#unit_constants

Also, wiki. It's a community thing.

Title: Re: Missing CRPL commands
Post by: kai on February 03, 2014, 12:03:15 PM
Quote from: Grauniad on February 03, 2014, 11:50:26 AM
http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getunitattribute
http://knucklecracker.com/wiki/doku.php?id=crpl:docs:setunitattribute

http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getunitattribute#unit_constants

Also, wiki. It's a community thing.

I didn't see any const called "CONST_GETATTRIBUTE"...
Also, I understand the meaning of wiki, but just bruteforce the function is a kind of time wasting right? ;)
Other than that, everything is fine.
Title: Re: Missing CRPL commands
Post by: Grauniad on February 03, 2014, 12:10:01 PM
I'm not responsible for what eduran puts in his syntax rules. :)

I think that was a form of shorthand for getting and setting of the various attribute constants. It has no place in the syntax per se.
Title: Re: Missing CRPL commands
Post by: Grayzzur on February 03, 2014, 12:12:28 PM
I  see on the CRPL Reference (http://knucklecracker.com/wiki/doku.php?id=crpl:crplreference) page, under Vars and Functions, there's a missing entry "Delete" - but that does not seem to be a valid CRPL command. Is that a placeholder for the "--" variable operator instead?
Title: Re: Missing CRPL commands
Post by: Grauniad on February 03, 2014, 12:24:03 PM
Quote from: Grayzzur on February 03, 2014, 12:12:28 PM
I  see on the CRPL Reference (http://knucklecracker.com/wiki/doku.php?id=crpl:crplreference) page, under Vars and Functions, there's a missing entry "Delete" - but that does not seem to be a valid CRPL command. Is that a placeholder for the "--" variable operator instead?

Yes. Here is the full list.

CRPL syntax mapping to internal  keywords.
:     FUNC
@   CALL
->!  REFWRITE
<-!  REFREAD
-?!  REFEXISTS
->  WRITE
<-  READ
-?  EXISTS
--  DELETE
(   OPENTRAN
)   CLOSETRAN
Title: Re: Missing CRPL commands
Post by: Grayzzur on February 03, 2014, 08:10:25 PM
Everything in the missing list as of today is now on the CRPL Reference page. I also replaced a few existing pages that didn't have the right namespace, causing them to seem to be missing (i.e. "crpl:GetCreeperColors" instead of "crpl:docs:GetCreeperColors").

With the exception of the warp operators. Do we want to add those, or is that concept sufficiently explained in the Overview?
Title: Re: Missing CRPL commands
Post by: knucracker on February 04, 2014, 09:23:28 AM
I think the warp operators can be left out.  It's syntax only and gets stripped out during compilations.  It's true there are OPENTRAN and CLOSETRAN internal keywords, but they get removed at the final step of compilation and result in the reordering the resulting opcodes that execute.