HTOTM: FUSION
No. echo() will print out strings in the toribash window. it was just an example. If you want to store "foo" into Variable just write
Variable = "foo"
into the text file. If you put
dofile("yourTextFile.txt")
into your script file, "foo" will be stored into Variable.

This:
out = io.open("yourTextFile.txt", "w")
out:write("Variable = \"bar\"")
will store the Variable but remember that all other values will be lost. You could use
out = io.open("yourTextFile.txt", "a")
out:write("Variable = \"bar\"")
to "overwrite" the value. In fact it will just put ' Variable = "bar" ' at the end of the file, leaving all other data. After a while you will have a monster text file though.

btw: Usually variables start with small letters. It's not necessary but it makes it easier to read the code.
Last edited by psycore; Oct 29, 2011 at 08:22 PM.
Signature temporarily out of order.
Aight! Thank you! But maybe it is possible to rewrite? By destroying that certain value and then re enter it?
It's just possible to clear the whole file and write everything again. There might be a way but I'm not sure and I've got no time to test it.
Signature temporarily out of order.
use get_obj_flag(obj_id) to get the flag of enviroment objects. The ids are the same as in the .tbm file.

There is no function for bodypart flags built in but I wrote one.
Either:
copy the code into your file or
put get_body_flag.lua into the script or the script/modules directory and then add 'require "get_body_flag"' into your file.

The usage is get_body_flag(player, bodypart).
I've only done quick testing so if anything doesn't work, leave a message.

Also I haven't found any information on joint flags. If I knew the flags I could create a similar function for joints.

e: for fixed version look here.
Last edited by psycore; Dec 7, 2011 at 05:22 AM. Reason: error in script
Signature temporarily out of order.
psycore, ofc bodyparts has flags.

i didnt know that io.open in the toribash can work with files from outside of /data/script folder

that fact breaks all my questions. tnx.

---------

what means "0xDEADCAFEBABE" in the your string?

lua code:
io.open("data/mod/"..get_game_rules().mod, "r", 0xDEADCAFEBABE)


i thought io.open has only two parametrs.

-------

get_body_flag.lua
does not work unfortunately.
as least for tb 3.69 and instagib_running.tbm
Last edited by Nirs; Dec 5, 2011 at 08:38 PM.
I think until 3.9 io.open just takes two arguments. But there should be something called popen(). I don't know it that well but i think you can do the same as with the io.open() of 3.91.
If the third parameter of io.open is not nil, the directory is <toribash>/. not <toribash>/data/script/.
the 0xDEADCAFEBABE was just boredom
Signature temporarily out of order.