Search the Community

Showing results for tags 'hex-editing'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Important
    • Announcements
    • Getting Started
  • Modding
    • Modeling
    • Level Design
    • Interface
    • Serverside
    • Noggit
    • Miscellaneous
    • Retro-Porting
    • Useful Services
  • Projects
    • Recruitment
    • Paid Work
    • Showcase
    • Machinima
  • Community
    • General
    • Random
    • Gallery
    • Releases
    • The Graveyard

Categories

  • Tools
    • Uncategorized
    • Map Editing
    • Model Editing
    • DBC & DB2 Editing
    • Serverside
    • CASC & MPQ
  • Resources
    • Graphics
    • Uncategorized
    • Models
    • Maps
    • Client Patches
  • 010 Editor Scripts and Templates
  • Noggit Script Brushes

Categories

  • Projects
  • Machinima
  • Software Development

Categories

  • Beginner
    • Русский
    • Deutsch
  • Modeling
    • Česky
    • Français
  • Level Design
  • Interface
  • Serverside
  • Miscellaneous
    • Česky
    • Français
  • Retro-Porting
  • Machinima

Categories

  • Tutorials
  • Timelapse
  • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Discord


Twitter


Skype

Found 1 result

  1. IntroductionDifficulty: Hard This tutorial is dedicated to explaining the basics of scripting in SweetScape 010 Editor. First of all, I want to say that I am not a programmer and the way I write the code may look weird to a person who knows more about programming. But following my way you can create useful script to automate many tasks you need to perform with World of Warcraft files. Important: You don't need any programming knowledge to start learning scripting in 010. I did not have any at first at all, so we are going to start from the real basics. 010 Editor uses two different filetypes to perform operations on the file. The first one is template (.bt) - it parses the file and gives us the structure with which we can work manually or within a script. Templates for most WoW files are already written and I am not going to teach you making them as I don't have that much of that knowledge myself. The next one is script (.1s) - scripts can be executed inside 010 editor, but unlike to templates, they can be excuted both on an open file or in a plain way (without a file opened). 010 Editor scripting uses a C-similar language. For experienced users: The language (1SC) used in 010 Editor scripting is indeed similar to C and shares most of the functions and syntax with it. Though, some parts of it are really weird and different from the the original C. Some functionality of C is not implemented. So, be careful and read the function reference. Learning basicsThis page contains a lot of useful information about this hex editor, though we are mostly interested in Function Reference part. Let's have a look at it. It contains a description of how you can use each available function. This is vitally important to read those definitions if you want to learn scripting. IO Functions are functions that take and return a value. They are used for most of our data operations including reading, writing and so on. Interface functions allow you to emulate the actions of a user such inside the editor, such as closing or saving the file, opening files, moving cursor and so on. Math functions are obviously doing some mathematical calculations. I have not used functions from other pages but I guess they can be useful too. So, the basic idea is to execute a template on a file, get the structure and read or write some values to it. Writing your first scriptSo, when I was learning 010 editor scripting what I started from was pure practice. Just trial and error method, no programming knowledge at all (I did not even have programming at school, as most people do). And I suggest you doing exactly the same thing because it is easier to learn by making something useful rather than reading boring theory written by some noob who obviously codes wrong in a non-professional way, but yet working. The first thing that we are going to do is a collision cloner script. The purpose of it is to copy collision from one .m2 model to another. Some of you may ask: "What's the use of it? Let's make something really useful!". Well, basically when you create custom models, sometimes you need to have some parts of model collidable and some not. The convertion software always sets collision to the entire model, which is not what we want. So we can create two version of a tree - with leaves and without leaves. Then we convert both to .m2 model and copy collision from the one without leaves to the one with leaves. So, we get a collideable trunk and leaves that you can pass through. Anyway, let's get started. Step 1. Investigating the dataFirst of all, when we know what we want to do we need to find out what data is reponsible for handling collision. The best source of information for that kind of things is our Wiki (the link is in the upper menu of the website). But in case of collision, everything is rather simple. So, first thing that I want you to do is to create an empty script file and open some .m2 model in 010 Editor. Apply the M2Template1.bt script on it. We get a dropdown with the structure: This is a shortened version because the list is too long to display. M2 file structure is based on offsets (starts with ofs). Those are values that are always located by the same adress no matter what model it is. They identify the adress of an actual block of data in the file. So, you can just read them and know where the actual data is written. The lines starting with (n) identify the amount of elements used in the data array. They are also static and are always located on the same adress. And everything else is structures. The client finds out how to read the file by reading ofs's and n's and finding out where the block of data is located in the file. There is no matter what the order of the data structure is when the static part is over. So, what we are going to do is: Read offsets for collision.Read the amount of data elements.Find and read the collision data depending on the given values.Copy it to the end of the target file.Change offsets and n-values to the proper values corresponding to the new data.The old data block will remain the file, but the client won't read that part as offsets won't point to that adress anymore. The last thing you need to do in this step is: Right click on the structure - Coloumn Display Format - Name. It will save you a lot of time in the future steps, just believe me. Step 2. Writing the scriptI will paste here the entire script and write comments to it explaining how things work. So, by reading attentively this script and trying to understand what it does you can learn the basics of scripting. Basically, it covers most operations that we need to perform on WoW files. Let's also look into some other useful things now. Useful patternsHere I will provide a set of code snippets that can be used for constructing your script in no time, not depending on the purpose of it. I will post plain code here and explain what each of them does and how it is better to use it. Snippet 1. Batch file processing.One of the most useful things in 010 editor scripting. It allows you to execute your script on multiple files at once. There are quite a few ways to do it such as CMD execution, but we will talk about that a bit later. Example script. Sets the MFBO chunk of an .adt to a given values: CMD ProcessingYou can also do perfectly without this snippet by using CMD way of execution. It has a lot of advantages comparing to what I just wrote. Though, ,y snippet allows you to select multiple files no matter what they are. You manually select what you want to do processing on from the folder. CMD way is very automatic and only works on a particular file extension. Create a script file that contains only processing, no InputOpenFileName and so on. Just plain processing. Create a .cmd text file containing this: Now you can save it an launch from the folder. You can also change the arguments. @ECHO OFF disables the CMD black window. /r enables processing in all the subfolders. for %%x in (*WMO) do 010editor "%%x" -script:"C:\Users\Skarn\Desktop\wmo-converter.1sc" executes the script on all the .WMO files. -nowarnings disables the warning window. -noui allows you to execute the script in a noui silent way, so you can process thousands of files and blinking windows won't bother you. Snippet 2. Coming soon!