Hello damn
despaired Sauerbraten community!
I playing this game since 2008 year and for all that time i've explored damn many nice and tricky things, i have good skills in cubescript and there is not that many things are impossible for me. It's even possible to read chat messages via cubescript, remote other computers/files/clients live, etc..
I will be glad to breath the new life into Sauerbraten
implementing new features and i hope u could help me with this shit.
My heart is opened for
YOU and
YOUR suggestions can change the world(sauer world ofc
), my friend!
I'll make everything for free guys, just
ask me, and wait for my
accept,
<3 u all!
And now, i wanna present you my very-old, but useful tool for cooperative editing modes -
multiplayer triggers(Yeah,
not SP!!!
).
Below u can previev teh code://triggerconstructor beta 3 by (ESP)Timon//
dumpfile = [
newgui savefile [
if (strlen (getalias [file_@@arg1])) [
[file_@@@arg1] = []
] [
[file_@@@arg1] = [@@@arg2]
guifield [file_@@@arg1]
textfocus [file_@@@arg1]
textsave [@@@arg1]
notepadfile = [@@@arg1]
cleargui
]
]
showgui savefile
]
dumptriggers = [
local filebuf shrinkbuf
looplist a $arg2 [
shrinkbuf = (concat $shrinkbuf $a)
looplist b $[trigger_bank_@a] [
filebuf = (format "%1addtrigger %2 %3^n^n" $filebuf $a $b)
]
]
filebuf = (format "shrinktriggers [%1 ]^n^n%2" $shrinkbuf $filebuf)
dumpfile $arg1 $filebuf
]
editmod = [
if $editing [
arg1
] [
if (= $getmode 1) [
if (isspectator $getclientnum) [
arg2
] [
edittoggle
arg1
edittoggle
]
] [
arg2
]
]
]
getcenter = [
local coeff
coeff = (cos $getcampitch)
concat (
+f (at $getcampos 0) (*f [-@arg1] (*f $coeff (sin $getcamyaw)))
) (
+f (at $getcampos 1) (*f $arg1 (*f $coeff (cos $getcamyaw)))
) (
+f (at $getcampos 2) (*f $arg1 (sin $getcampitch))
)
]
listpos = [
local buf
editmod [
cancelsel
local a b
a = $entdrop
b = $entautoviewdist
entdrop 0
entautoviewdist 0
newent particles -357
buf = [[[@@@getcampos] @@getclientnum] ]
looplist c $listclients [
goto $c
buf = (concatword $buf "[[" (getcenter 32) "] "$c"] ")
]
entautoview
delent
entdrop $a
entautoviewdist $b
]
result $buf
]
getpos = [
local buf
editmod [
cancelsel
local a b
a = $entdrop
b = $entautoviewdist
entdrop 0
entautoviewdist 0
newent particles -357
goto @arg1
buf = (getcenter 32)
entautoview
delent
entdrop $a
entautoviewdist $b
]
result $buf
]
dist = [
sqrt ((+f (+f (pow (-f (at $arg2 0) (at $arg1 0)) 2) (pow (-f (at $arg2 1) (at $arg1 1)) 2)) (pow (-f (at $arg2 2) (at $arg1 2)) 2)))
]
addtrigger = [
[trigger_bank_@arg1] = (
format "%1 [[%2] %3 [%4] [%5]]^n" (getalias [trigger_bank_@arg1]) $arg2 $arg3 $arg4 $arg5
)
]
shrinktriggers = [
looplist a $arg1 [
[trigger_bank_@a] = []
]
]
parsetriggers = [
looplist a $[trigger_bank_@arg1] [
local entered
looplist b $ci [
if (< (dist (at $a 0) (at $b 0)) (at $a 1)) [
entered = (format "%1[%2] " $entered $b)
]
]
if (strlen $entered) [
do (at $a 2)
] [
do (at $a 3)
]
]
]
starttriggers = [
local ci
editmod [
ci = (listpos)
parsetriggers @arg1
]
sleep $arg2 [
starttriggers @arg1 @arg2
]
]
//Script done by (ESP)Timon//
Below manual how to use it:First at all u should download my attachment(
triggers.txt), and place it into
main game folder.
then, start the game, go into
coop edit, then press T or ~ and write next:
/exec triggers.txt
After u did the first step, u can construct triggers immediately (alles Gute für Sie
)!
To do this, there's a command called "
addtrigger", its structure is the next:
addtrigger (trigger bank name) [X Y Z] (radius of a trigger) [do if true] [do if false]Trigger bank name - any name u like, i'd prefer to declarate their names like: bank1, bank2... etc. (trigger bank constains all triggers inside u declarated via "addtrigger" as array, or list)
[X Y Z] - position of trigger, depends on world coordinates, u can set it manually or use current camera position (setting this argument to
$getcampos, without brackets ofc, it's a cubescript call
).
Radius of a trigger - radius to activate, the same as in envmap, sound and light ents (player height is 16 by default)
.
[do if true] - place ur script into square brackets, that should be executen if any player joins into a trigger.
[do if false] - same as upper, but vice-versa.
For example we can fly to needed map spot and then write this:
/addtrigger bank1 $getcampos 16 [entfind particles; delent; echo $entered]
This stuff will push new trigger into bank called "bank1" with coordinates that equals current camera position with radius 16. if any player gonna join into this trigger it will delete all particles and print to
YOU info about players that inside of this trigger(info struct [[X Y Z] CN] [...]) ("
entered" is a declarated variable used in "
parsetriggers" function).
This triggers will not work until you start them
.
To do this, use "
starttriggers" command, its structure is the next:
starttriggers (trigger bank name) (delay to repeat triggers)Trigger bank name - name of bank where your triggers are placed (in our case it's "bank1").
Delay to repeat triggers - delay needed to update all triggers in the current bank,
set it 99 by default.
For example, to start triggers, type next:
/starttriggers bank1 99
To stop maintain all triggers, just write
/clearsleep
To clean up bank1 from all triggers, write
/shrinktriggers bank1
(you also can clean few banks in a row, example /shrinktriggers [bank1 bank2 ... bankN])
to dump trigger bank into a file, write
/dumptriggers mytriggers.cfg [bank1 bank2 ... bankN]
( mytriggers.cfg - file name where to save)
Below additional capabilities:U can also stack triggers, because if u're adding too many triggers in one bank, they checking in one loop too slow, make tree-like structure to serve them.
addtrigger bank1 [512 512 512] 256 [parsetriggers bank2] //if this trigger become active, it's will automatically check triggers in bank2, but not else.
addtrigger bank2 [550 550 512] 16 [echo test]
addtrigger bank2 [450 450 512] 16 [echo hello]
starttriggers bank1 99
Warning: don't forget to shrink trigger banks, if u wanna remake them!Below features and misc:Using this useful shit u can make things like a:
- deathruns;
- places that killing others;
- rpgs;
- buttons;
- change ents;
- MUH MOAR!!! (use ur imagination xD )
This script also constains functions that getting other player positions and position lists, u can find them useful. (do velocity check to make falldamage for other players xD)
Also, "getcenter" function can become a nice tool to check distances
You can use "dumpfile" to send files(configs) via maptitle or etc to other clients in editmode. (if u know how to send scripts via maptitle ofc XD)
Be happy and use dat free
Below u can see changelog:- Beta 2:
- New filedump structure("dumptriggers" command)
- Addtrigger function uses new format, compatible with current filedump
- Beta 3:
- Optimised editmod command
- "starttriggers" launch "parsetriggers" function in editmod now(reduces overflow)
- Local "entered" inside of "parsetriggers" also contains positions now
- Beta 4:
- dumptriggers function is fixed
- TODO: made dumpfile func save comments "//"
P.S. Sry for bad english xD... Report all bugs if u find them and ur suggestions too.
To send this script other players ingame, use:
/textfocus textbuf; textload triggers.txt; maptitle $textshow
And request them to write:
/do $maptitle
Don't forget, most of this stuffs working only in coop edit mode.