more calling questions

tedrock

New member
is there a way to call a specific line from a file? like if i had a list of drinks i could just tell it to call line 4

also is there way to mirror or write data to a specific line in a file or even clear the whole file before writing to it?

the reason this could be usful is for having a separate preference file for a script so people don't need to change all the preferences again when they update it. also the clearing a file before writing could be usful for those mushroom scripts. you just tell it to write to a file whatever the next day is so next time you run the main mushroom script it will just do something like
Code:
call runthisscript.txt
and runthisscript.txt just has like
Code:
call 4.txt
or whatever depending on what day you are on. then after the script is done for the day it just writes call 5.txt over call 4.txt or whatever to runthisscript.txt so it will run day 5 the next day...
hope that made sense :p
 

Nightmist

Member
No there is no way to call a specifc line but when you move into ASH scripting you can call certain blocks of code.

To print to a file you can always try using a combo of mirror and echo (CLI commands). Then again that wont erase before printing.

In ASH you could alway use a ingame variable counter (Meat pastes in closet for example, although I would pick something that you wont be meat pasting with since mafia may pull to create a item and by doing so mess up your counter.)
 

tedrock

New member
so i assume with the new commands...

string get_property(string)
void set_property(string,string)


we don't have to use ingame varibles anymore...? now if someone can someone give me an example of how these are used in an ash script that would be loooovely.
 

Nightmist

Member
[quote author=tedrock link=topic=164.msg911#msg911 date=1148878593]
we don't have to use ingame varibles anymore...? now if someone can someone give me an example of how these are used in an ash script that would be loooovely.
[/quote]

Code:
set_property(string,string)
This writes to the .kcs data file for that character. It adds a line with the first string being the "name" and then the value being the second string.
Example:
Code:
set_property("ExampleName","ExampleValue");
This would add a line to the .kcs file:
ExampleName=ExampleValue

Code:
get_property(string)
This returns as a string the value associated with the "name".
Example:
Code:
print( get_property("ExampleName"));
Assuming you did the "set_property" example the print command would print "ExampleValue".


Edit:
Ive done some testing and you may be familiar with the "set" command in the basic CLI scripting.
Code:
set_property(string,string)
is effectively the ASH version of that (you can edit existing values with this command aswell as define new ones however).
 
Top