The following will be a progress thread for my open sourced clientscripts editor.
The aim will be for this editor to be used across revisions, though will be initially built for 727 and expanded upon from there.
I urge anyone trying to learn how CS2 works to use this project. I will try and keep everything very simple and easy to understand.
I will begin extensively commenting everything once I am near completion, so everyone can understand the reasoning behind everything.
A parser to parse the scripts from plain text
A decompiler to decompile the scripts to plain text
Alright, onto the progress:
Spoiler for parser:
Currently, most everything is supported, with only a couple features not yet added because I have decided not to yet. That said, I'm 100% certain there are small things that I have forgotten, and will be added later.
Creation and Assignation on same line
Basic instructions (send_message, to_string, others to be added, when needed)
Calling other scripts with parameters
Else if statements
Multiple statements with ||
Bracketed expressions with statements
Multiple statements with &&
Spoiler for decompiler:
The decompiler has been started and can be found at: http://github.com/pyragon/cs2-decompiler
So far it can print out basic scripts, adding more statements/expressions isn't very hard, so I don't see it taking too long.
After that it's really all about just making sure each instruction is added.
if statements (with 'else' statements, no 'else if' statements yet tho)
calc function calls
Basic function calls
Return statements (with values)
Else if statements
Multiple expressions in statement with || or && (|| should work already with how I made statements, but haven't tested so leaving red)
Else if statements on same line
variable creation/assignation on same line if possible
Spoiler for Cross-Revision:
An end goal of this project is to allow multiple revisions to use it.
Unfortunately, the opcodes for instructions change every revision. It's quite a tedious task to find each one for a revision, almost like identifying every packet, except theres a lot more of them.
As far as I know, there is no easy way to identify these, but if anyone knows how, I would love to learn so we can try and make this available to everyone.
Once I am finished though, I will slowly try and identify some instructions for other revisions, and will at least get them started so others can continue to identify them for the revision that they would like.
neat as far as locating instructions go, I would recommend doing something like this which allows testing any opcode on the fly with immediate results. I don't know how other revisions handle their client scripts but I would have to assume the system is generally the same.
Opcodes will always be an issue, and trying to support them all would most likely delay release or require constant maintenance.
When developing my tool, I found it was a lot easier to allow clients to specify a plugin for their specific read values. That way the opcodes for reading could be updated by a third party, rather than you (or the client). The plugin would specify the proper read values (and write values, if needed).
Your app could have in-app support for opcodes which are supported by common revisions, so average users won't have to worry about defining their own read values for common revisions. You could define the common read values as your own plugin, which comes bundled with the app.
Now that we're working on clans and citadels on Darkan, we've been needing these a lot more, so i've fixed quite a few things with the decompiler. The parser will need to be updated to work again with the changes I've made to the decompiler, so I'll be doing that at some point soon.
There are still some bugs to work out, and some cleanup to do, but almost everything is done now.