KAOS How To
This article is about a project that is in development. Information may change significantly as the project progresses. |
Contents
Install
I presuppose you have some basic knowlage, of inner caos-working,c16-image-editor,folders , about agents etc.
Download kaos_1.tar.bz2 , untar and copy kaos and mach.sh in /usr/local/bin.
Whats new
My version runs with normal Linux Creatures Evolution Engine, if the cos-files ar put in Bootstrap-folder.
The Numbers of script command cloud now be up to 65535.
The big advantage of kaos is : the scripts are more readable and modern as caos .
My precompiled version of kaos-compiler has the librarys included:
attrbhvr.k prelude.k KaosLib.k lib2.k
In this libs most of commands for everyday use of caos are defined. If you need a new command or macro write an include file and bind it to youre source.
Only if you have many of then an recompiling would be usefull.
How to use
Simply take an texteditor (geany would be perfect , I am planning some extantions), write code and save file with *.k
Then type mach.sh foo.k , output is saveed as foo.k.cos.
For using newcompound(), in my way first you have to define the variables:
... define numeric F_INVISIBLE = 1 ;define numeric G_SYSTEM = 1 ; ... ... newcompound(F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR, "ds gui", 77,2, 5000); ...
or you write an extra file with predefined constants. see classifiers.k
This allows you to build an table for multiple use without looking for Classification_system all time.
other constants see e.g. predef.k (these are the same used by dockingstation ov01,ov02... for agents)
AND to defin new commands make new file e.g. mylib.k and then
... #include my.lib #include classifiers.k #include predef.k ...
Important NOTE the includes MUST BE AT TOP OF FILE (only an poor shell-script include yet)
How to write an new caos command
This is simple . See first in doc/index.html if command is allready definied.
You need for example SIN
next time
A little demo-agent
/** Script: simplemonitor ___________________________________________________________________________ Version 0.1 Copyright (C) 2008 august0815 * under GNU * ----------------------------------------------------------------------------- * Agent : F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR * Sprites: ds gui ( orginal dockingstation sprites) * ----------------------------------------------------------------------------- */ #include classifiers.k #include predef.k ovar numeric hidden[99];//true=1 false =0 install { agent simplemonitor; simplemonitor = newcompound(F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR, "ds gui", 77,2, 5000); simplemonitor.attributes = A_CAMERASHY|A_FLOATABLE|A_INVISIBLE;; simplemonitor.floatat(-331, 400); simplemonitor.tick = 2; simplemonitor.hidden=1; simplemonitor.newtextinputpart(1, "ds gui", 4, 100, 100, 0, 0, "whiteontransparentchars"); simplemonitor.changepart(1); simplemonitor.textformat(1 ,1, 1, 1, 1, 1, 0); simplemonitor.newtextinputpart(2, "ds gui", 4, 100, 135, 0, 0, "whiteontransparentchars"); simplemonitor.changepart(2); simplemonitor.textformat(1 ,1, 1, 1, 1, 1, 0); simplemonitor.newbutton(3, "ds gui", 14, 77, 331, 0, 0 ,"[]", 2000, 1); simplemonitor.newbutton(4, "ds gui", 16, 77, 331, 170, 0 ,"[]", 2001, 1); } script (F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR,2000) {agent a=owner; if (a.hidden==0) {velocity(a,(-20),0);wait(15);velocity(a,(0),0);} a.hidden=1; } script (F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR,2001) {agent a=owner; if (a.hidden==1) { velocity(a,(20),0);wait(15);velocity(a,(0),0);} a.hidden=0; } script ( F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR, 9) { agent s;s=owner;numeric room;numeric x;numeric y;numeric type;string fo;numeric foo;string fooo; string ausgabe="Room ";numeric xx;numeric yy; s.changepart(1); room=getroomid(mouseX(),mouseY()); ausgabe="X: " ; xx = pointer.x; ausgabe=addstring(ausgabe,NumToStr(xx)); s.parttext=ausgabe; s.changepart(2); ausgabe="Y: " ; yy = pointer.y; ausgabe=addstring(ausgabe,NumToStr(yy)); s.parttext=ausgabe; } remove { enum (F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR) {|p| p.kill();} // Zap the scripts. deletescript( F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR,9); }
ADDITIONAL OPTIONS
Geany IDE
TODO
- more commands predefined ...
- Substituting
script (F_INVISIBLE, G_SYSTEM, S_SIMPLEMONITOR,2000) with script (monitor , clicked) ...
NOTES
Link
Download at http://www.creaturetopia.org/viewtopic.php?f=10&t=117&p=6525#p6525