Thread: Custom CS2 Scripts

Results 1 to 6 of 6
  1. #1 Custom CS2 Scripts 
    Registered Member
    Stugger's Avatar
    Join Date
    Apr 2016
    Posts
    208
    Thanks given
    119
    Thanks received
    294
    Rep Power
    358
    Hey guys. So I've been crawling my way through the client side of my project while I wait for my new PC parts to arrive, trying to de-obfuscate and pick up on anything where I can. I've been taking a look into CS2 scripts and I really can't get my head around how they're de/recompiled. I figure this is something not many people know. Honestly almost anything cache/client related kills my vibe haha.

    So anyway, to avoid trying to figure out how any of that is actually dealt with I just decided to try and make my own custom scripts, however not quite as optimal... I've basically just studied how the scripts are broken up into a series of opcodes and values that the executor works from. Currently, my scripts are essentially just text files stored in the client project. I wrote some functionality to read from said file when the script is called and basically break it into an executor readable format. I mean it works and I can overwrite existing scripts which is real cool, but I don't particularly like how its handled. Aside from the fact that I pretty much have to write a language in order for it to be readable; I don't like that they're not cached...

    This may be a dumb question, I really am not versed in handling this kinda stuff, but is there a "somewhat simple" way to go about caching these and implementing it specifically for this purpose? if not simple, could someone at least point me in some direction? I get an aneurysm anytime I break open these client sided mumbo-jumbo decompiled classes. Seems everything is just scattered about aimlessly. Honestly though if you veterans out there think this is sufficient as is then I'll just stick to it, I'm just not sure tbh. I assume it's fine for basic scripts but I'd like to optimize this the best I can before I dive into writing more in-depth / process heavy scripts.

    This script I put together is one that allows setting the size of any interface component, considering I couldn't find an actual script/packet that did this on its own to a specified widget, I decided to start there:
    Code:
    void script_10001(Widget widget0, int arg1, int arg2) {
    	widget0.setActive();
    	widget0.setSize(arg1, arg2, 0, 0);
    	return;
    }
    Attached image
    Reply With Quote  
     

  2. #2  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    26
    Posts
    1,474
    Thanks given
    3,312
    Thanks received
    691
    Rep Power
    1098
    IIRC Mgi125 & Admiral Slee have both provided tools for working with CS2 scripts.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Stugger's Avatar
    Join Date
    Apr 2016
    Posts
    208
    Thanks given
    119
    Thanks received
    294
    Rep Power
    358
    Quote Originally Posted by hc747 View Post
    IIRC Mgi125 & Admiral Slee have both provided tools for working with CS2 scripts.
    I mean I’m aware of decompilers and posted information regarding script data, but I haven’t seen any actual tools or in depth information relating to editing, compiling and repacking. Maybe I’m missing something, would you happen to have any links? My method is pretty effective, I have a pretty decent understanding of how the data is handled, it’s just time consuming implementing the language. I think all would be good if I could get these cached.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Incendiary's Avatar
    Join Date
    Jul 2009
    Posts
    348
    Thanks given
    94
    Thanks received
    43
    Rep Power
    160
    Been using CS2 Compiler(/Decompiler) for some time now. As far as I remember I've made some changes to it to make it load from and save to the cache directly, but that should be fairly simple to implement.
    Reply With Quote  
     

  5. Thankful users:


  6. #5  
    Registered Member
    Stugger's Avatar
    Join Date
    Apr 2016
    Posts
    208
    Thanks given
    119
    Thanks received
    294
    Rep Power
    358
    Quote Originally Posted by Incendiary View Post
    Been using CS2 Compiler(/Decompiler) for some time now. As far as I remember I've made some changes to it to make it load from and save to the cache directly, but that should be fairly simple to implement.
    So as it stands, it's not capable of cache reading / writing? that's essentially the problem I am having here haha.
    It looks awesome though. Thank you! I'll need to take a look into it, just been having a little too much fun with this on-the-go scripting
    Attached image
    Reply With Quote  
     

  7. Thankful user:


  8. #6  
    Registered Member

    Join Date
    Dec 2009
    Posts
    774
    Thanks given
    367
    Thanks received
    455
    Rep Power
    927
    Quote Originally Posted by Stugger View Post
    So as it stands, it's not capable of cache reading / writing? that's essentially the problem I am having here haha.
    It looks awesome though. Thank you! I'll need to take a look into it, just been having a little too much fun with this on-the-go scripting
    Attached image
    Add Gradle to the project:
    Code:
    gradle init
    Then use this `build.gradle` file:
    Code:
    apply plugin: 'java'
    apply plugin: 'maven'
    
    buildscript {
        repositories {
            mavenCentral()
            maven {
                url 'https://plugins.gradle.org/m2/'
            }
        }
    }
    
    group = 'cs2-editor'
    version = '1.0'
    
    description = 'Vincent\'s CS2 editor'
    
    sourceCompatibility = 8
    targetCompatibility = 8
    
    repositories {
        jcenter()
        mavenCentral()
    }
    
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'lib')
        implementation 'com.displee:rs-cache-library:6.4'
    }
    
    compileJava.options.encoding = 'UTF-8'
    
    tasks.withType(JavaCompile) {
        options.encoding = 'UTF-8'
    }
    You can then read stuff from your cache like:
    Code:
    CacheLibrary cache = CacheLibrary.create("C:\\Users\\Displee\\Documents\\RSPS\\OSRS\\180\\cache");
    byte[] data = cache.data(12, script_id);
    link removed
    Reply With Quote  
     

  9. Thankful users:



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: 1
    Last Post: 04-22-2020, 09:42 PM
  2. [700+] Decompiled cs2 scripts
    By mgi125 in forum Downloads
    Replies: 13
    Last Post: 05-19-2016, 07:47 PM
  3. RS3 [812] 9960 decompiled cs2 scripts
    By mgi125 in forum Downloads
    Replies: 21
    Last Post: 10-08-2015, 04:14 AM
  4. All my custom combat scripts don't work?
    By fishboy9449 in forum Help
    Replies: 4
    Last Post: 01-23-2015, 11:15 AM
  5. Replies: 11
    Last Post: 07-08-2014, 12:48 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •