Hi, I have got quite a few project going on at the moment but this one is the one I have decided to let you know about.
Client Script 2 visualisation
As you might know, client script 2 (CS2) are the scripts used by post 317 client (474 has them, 317 just has CS1) to have interfaces execute actions not possible with CS1.
In its raw format, a script has a couple of arrays with integer and string information.
For example:
Code:
ScriptId = 47
InstructionCount = 30
Instructions = 33 0 10 6 33 4106 21 33 0 10 6 3 33 4106 37 21 33 0 32 6 3 33 4106 37 21 33 4106 21 3 21
StringOperands = NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL "0" NULL NULL NULL NULL NULL NULL NULL NULL "00" NULL NULL NULL NULL NULL NULL NULL "" NULL
NumericalOperands = 0 99 1 3 0 0 0 0 9 1 5 0 0 0 2 0 0 0 1 5 0 0 0 2 0 0 0 0 0 0
IntegerVariableCount = 1
StringVariableCount = 0
IntegerArgumentCount = 1
StringArgumentCount = 0
The above example contains 30 instructions.
This project aims to condense this cluster of data into a script-like syntax (read only for the moment).
So eventually, a more readable version would look like this:
Now it is beginning to be readable. What this example script appears to do, is take a number variable (the argument of the script) and return a string with at least 3 characters.
If the number has less than 3 digits, the string is filled with 0's in front.
There is still much to be done for this (read-only) project.
These include:
- Figuring out and adding the rest of the instructions
- Condensing "else { if{" to "else if{" structures when possible
- Recognizing while-do loops (they're a special case of if-else-loops)
- Recognizing for-loops (they're a special case of while-do loops)
- Other if-else optimizations
- return types support
- argument support
- Being able to give names to scripts (in an external file)
Ideally , the output would be something like this:
Code:
if(99 < numVar0){
return numVar0.toString();
} else if(9 < numVar0){
return "0" + numVar0.toString();
} else if(0 <= numVar0){
return "00" + numVar0.toString();
} else {
return numVar0.toString();
}
If you wonder what a certain script (I'll need the number) looks like according to my project (at that moment). Leave a post citing which one it is.