Thread: CS2 Visualisation

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 CS2 Visualisation 
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    967
    Thanks given
    47
    Thanks received
    161
    Rep Power
    366
    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.
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Member
    Join Date
    Sep 2012
    Age
    27
    Posts
    172
    Thanks given
    22
    Thanks received
    7
    Rep Power
    0
    Nice one, good luck with this
    Reply With Quote  
     

  4. #3  
    Registered Member
    Join Date
    Oct 2013
    Posts
    189
    Thanks given
    80
    Thanks received
    37
    Rep Power
    12
    Goodluck .
    Reply With Quote  
     

  5. #4  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    967
    Thanks given
    47
    Thanks received
    161
    Rep Power
    366
    Take a look at the wilderness level interface script (#54).
    Still need to make the adjustments to make the flow look a bit smoother:
    Code:
    label2:	numVar0 = getAbsY(ABS_LOC=getAbsLoc());
    	numVar1 = ((numVar0 - 9920) / 8) + 1;
    	numVar2 = ((numVar0 - 3520) / 8) + 1;
    	if(6400 < numVar0){
    		goto label28
    	} else {
    		getGameInterface(0x17d0001).setDisabledText(String.combine("Level:_", (numVar2).toString()));
    label36:	return;
    	}
    label28:getGameInterface(0x17d0001).setDisabledText(String.combine("Level:_", (numVar1).toString()));
    	goto label36
    Reply With Quote  
     

  6. #5  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    nice stuff. Are the labels you have listed there for the jump table data?

    i like the way that (forgot his name, made a cs2 decompiler) did it syntax wise

    Code:
    void script_id(args) {
    
    }
    then the args don't seem to be appearing from nowhere
    Reply With Quote  
     

  7. #6  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    967
    Thanks given
    47
    Thanks received
    161
    Rep Power
    366
    Quote Originally Posted by Harlan View Post
    nice stuff. Are the labels you have listed there for the jump table data?

    i like the way that (forgot his name, made a cs2 decompiler) did it syntax wise

    Code:
    void script_id(args) {
    
    }
    then the args don't seem to be appearing from nowhere
    They're there for the jump table yes (although, due to instructions merging into eachother and some faulty programming on my side), the label numbers can differ from the goto instruction.

    The arguments and return values are one of the optimizations I plan to do as well.
    Possibly even manually naming them (external format ofcourse).
    Reply With Quote  
     

  8. #7  
    Renown Programmer


    Join Date
    Jul 2009
    Posts
    1,846
    Thanks given
    69
    Thanks received
    1,113
    Rep Power
    3170
    http://www.rune-server.org/runescape...ecompiler.html
    http://www.rune-server.org/runescape...667-cache.html


    Code:
    string script_47(int arg0) {
    	if (arg0 > 99) {
    		return intToStr(arg0);
    	}
    	if (arg0 > 9) {
    		return "0" + intToStr(arg0);
    	}
    	if (arg0 >= 0) {
    		return "00" + intToStr(arg0);
    	}
    	return intToStr(arg0);
    }
    Reply With Quote  
     

  9. Thankful user:


  10. #8  
     

  11. Thankful user:


  12. #9  
    Registered Member
    TheChosenOne's Avatar
    Join Date
    Jan 2013
    Posts
    967
    Thanks given
    47
    Thanks received
    161
    Rep Power
    366
    Seems I'm not the first one to do this =-).
    Thanks for the link Joshua, that should be helpfull for future versions.
    Reply With Quote  
     

  13. Thankful user:


  14. #10  
    Registered Member
    Velocity's Avatar
    Join Date
    Jan 2009
    Age
    28
    Posts
    2,028
    Thanks given
    1,013
    Thanks received
    2,376
    Rep Power
    4112
    xxxxxxx
    Reply With Quote  
     

  15. Thankful users:


Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 9
    Last Post: 03-28-2008, 09:57 PM
  2. [TUT]Adding scanlines[PS CS2]
    By Klaasje in forum Tutorials
    Replies: 1
    Last Post: 12-24-2007, 05:19 AM
  3. Replies: 3
    Last Post: 10-04-2007, 11:53 AM
  4. [TUT]Creating a userbar[PS CS2]
    By Klaasje in forum Tutorials
    Replies: 2
    Last Post: 09-26-2007, 06:30 PM
  5. [TUT]Adding reflection to a userbar/sig[PS CS2]
    By Klaasje in forum Tutorials
    Replies: 0
    Last Post: 09-22-2007, 02:17 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •