When you look for command usage examples when debugging your very first CAOS console application, there's not much you can find :
- The "inst,dde: getb cnam,endm" every single kit, app or example uses as a demo ( it shows current creature's name )
- Some "cheat codes" to kill creatures, give them full life... always the same ones, and never any further documentation of how they work.
- Raw CAOS documentation, with very few information on actual syntax, importance of spaces, commas or variables...
Just so you don't tear your hair out on your early CAOS experiments, here is a list of snippets that do some basic stuff, that you can just copy and paste in your CAOS console or custom app, without wondering if you should use lowercase, uppercase, commas, spaces brackets exactly as in the documentation or not.
This is neither a CAOS tutorial nor a complete documentation rewrite (those are coming in future articles though).Just a sample of readily usable code bits illustrating the use of some common commands you might need.
( Those are Creatures 1 CAOS snippets, though most of them should work the same on other games too. Things that could change include : chemical names, object classification, system menus ID's...)
Get current creature's name :
dde: getb cnamSelect the grendel:
enum 4 2 0,sys: camt,setv norn targGet quick stats on all norns:
dde: getb ovvdThis returns a list of parameters delimited by pipes "|' and is interpreted as such:
Name|Moniker|Sex|Age|Pregnancy|Life Force|Medical condition|Current Room|Xposition|Yposition
Count how many objects of any given classifier exist in the world:
dde: putv totl 4 1 04 1 0 is norns
4 2 0 is grendels
4 0 0 is norns and grendels ( and anything else if you imported ettins or other species in C1 )
Get the number of rooms in the game:
dde: putv rms#Make the hand say something
(Norns don't hear it nor act upon it when you use 'say$', useful for debugging messages.Brackets are mandatory )enum 2 1 1 say$ [Hello there]
Get the hand's position ( given in absolute world coordinates ):
enum 2 1 1 dde: putv posl,dde: putv posr,dde: putv post,dde: putv posbA sample of using sys: cmnd # for running existing menu options :
(The complete list of ID's for C1 and C2 can be found here )Pause the game:
sys: cmnd 32838
Resume the game
sys: cmnd 32837
Toggle infinite scrolling :
sys: cmnd 32774
Show the level of a given chemical in current creature's bloodstream :
(59 is glycogen, which is the measure of the creature's life force shown in the bottom toolbar.Remember you will get a value between 0 and 255, not a percentage )
dde: putv chem 59
Read the content of any script in the game from it's classification numbers:
Here the activate script for cheese :2=simple 6=food 1=cheese 1=activatedde: scrp 2 6 1 1
Move the creatures game window to an arbitrary position and size on the desktop:
Parameters are Xposition Yposition Width Height. 0 0 is top left screen cornersys: wpos 0 0 1024 768
Get a given chemical's level for all norns:
Here again 59 is life force, and 4 1 0 is "All Norns" :enum 4 1 0 dde: putv chem 59 next,endm
Move current target relatively:
Parameters are Xdisplacement, and Ydisplacement. Expressed in world coordinates,starting top leftmvby 10 100
Move current target to a fixed position
Parameters are Xpos, and Ypos.Expressed in world coordinates,starting top left. 2200 500 is roughly the kitchen :mvto 2200 500
Pick up current item :
Works to some extent on Norns too, but you can't get them past current room's boundaries that way:edit
Get a creature's age :
dde: getb ctimGet back to the kitchen and make me a sandwich:
sys: cmra 2200 500Randomly target a Norn and center cam on it ( doesn't make it current Norn ):
rtar 4 1 0,sys: camtRandomly target a Norn and center cam on it (does make it current Norn ):
rtar 4 1 0,setv norn targ,sys: camtOpen a new world file ( brackets are mandatory)
sys: wrld [burrows.sfc]Take a picture and save it to a file:
dde: pict W|HWith W and H being raw values for the image Width and height.
See this article for an explanation of how to manipulate the file this command returns.
The "Show me one" command(Randomly target an object of corresponding classification, center cam on it, and circle it in pink) :
rtar X Y Z,sys: camt,sys: edit posl post posr posb With X,Y,Z being the required classifier.Use 0 for wildcard.
The "Show me one" command ran on herbs |
No comments:
Post a Comment