Mag-Tools Idea: Write a line to file (moved from VT General)
Posted: December 8th, 2016, 1:19 am
DecalDevForums version of this thread here
So I had an idea that would extend what we can do in metas
I was talking about it in /vcg and Magnus wanted me to post it here
I decided to flesh the idea out a little bit
I moved this topic from the VTank forum since it pertains primarily to magtools
If we had a simple plugin that could write a line to file and delete, we could have permanent variables
Maybe limit the file operations to a single folder if safety is a concern (or make enabling the command an option in mag tools (my preference)
Then when you load the meta later:
If you wanted get fancy maybe add a replace line function so the file doesn't have to be completely rewritten each time that would replace the first line that matches the whole string (doesn't have to be whole line match, but replaces whole line). I think this would be useful for statistics gathering metas if you didn't want to make a command that rewrote everything at the end of your session.
If the line doesn't exist, an info message is printed and the text is written to a new line.
In the meta you could write values like... (If I'm escaping characters that I don't need to, I apologize.)
Of course permavars are not the only potential use for this idea but its certainly a great one. if i had my way about the implementation of these commands. I would keep them as open as possible so people can think up new ways to use them later on.
Personally. I think it would be great if we could get this and other basic file operations so we can do things like copying over mag-tools auto trade profiles with meta triggers (maybe a file extension whitelist? user configurable). I realize with public metas there are potential security implications, but think that making it opt in (along with a very visible warning when the person/meta tries to use it when not enabled) along with warning when it is enabled should be enough. and if someone does it anyway... you can't say they weren't warned. It would take 5 seconds for an experienced user (who has enabled the option) to open a suspect met file and do a search for the offending commands
So I had an idea that would extend what we can do in metas
I was talking about it in /vcg and Magnus wanted me to post it here
I decided to flesh the idea out a little bit
I moved this topic from the VTank forum since it pertains primarily to magtools
If we had a simple plugin that could write a line to file and delete, we could have permanent variables
Maybe limit the file operations to a single folder if safety is a concern (or make enabling the command an option in mag tools (my preference)
Code: Select all
/mt delete C:\permvars.txt
/mt write C:\permvars.txt /vt mexec setvar[permvar, Value]
Code: Select all
/loadfile permvars.txt
Code: Select all
/mt writereplace C:\permvars.txt "/vt mexec setvar[permvar," "/vt mexec setvar[permvar, NewValue]"
In the meta you could write values like... (If I'm escaping characters that I don't need to, I apologize.)
Code: Select all
ExprChat: \/mt write C\:\\permvars.txt \/vt mexec setvar\[permvar\,+getvar[permvar]+\]
Personally. I think it would be great if we could get this and other basic file operations so we can do things like copying over mag-tools auto trade profiles with meta triggers (maybe a file extension whitelist? user configurable). I realize with public metas there are potential security implications, but think that making it opt in (along with a very visible warning when the person/meta tries to use it when not enabled) along with warning when it is enabled should be enough. and if someone does it anyway... you can't say they weren't warned. It would take 5 seconds for an experienced user (who has enabled the option) to open a suspect met file and do a search for the offending commands
Code: Select all
regex: \\?\/\\?m\\?t\\?.\\?((d\\?e\\?l\\?e\\?t\\?e)|(c\\?o\\?p\\?y))