sannybuilder / dev

Sanny Builder Bug Tracker and Roadmap development
https://sannybuilder.com
49 stars 0 forks source link

NEW FEATURE: Compile the command names. #124

Closed MatiDragon-YT closed 4 months ago

MatiDragon-YT commented 3 years ago

Well, first of all ... I hope I'm not bothering anyone with all my tickets/topics ... and second, I warn you that what you are going to read next may sound a bit silly.

This is not just about making the "command names" of each opcode compatible. But it is also a small idea that came from converting models to numbers to hexadecimal... I was wondering if something similar could be added for opcodes. Something that converts the opcode to its class with its respective member and also that can be converted to a command. Although this functionality is not as interesting or useful as #121 , #122 and #123, this functionality aria that most of the scripts made in GTA3Script and in PluginSDK are possible to compile in SannyBuilder.

clase

2@ = Char.Create(4, #MALE01, 0.0, 0.0, 0.0)

opcode

009A: create_char 4 model #MALE01 at 0.0 0.0 0.0 store_to 2@

command name

CREATE_CHAR 4 #MALE01 0.0 0.0 0.0 2@
x87 commented 3 years ago

I like this idea. Essentially this is what Source Converter that lives in tools\Source Converter supposed to do. It is however pretty outdated.

XMDS commented 3 years ago

I very much agree that the SB tool can achieve mutual conversion between OP, class, and gta3sc syntax. But it is not necessary to compile the script of the SDK. In addition, if cleo is written using the original gta3sc syntax, the current SB SCR mode already has this function, but people may prefer thelink2012 gta3sc extension to use vscode to write scripts instead of SB. The focus of SB should be around building a class grammar for programming, x87 is building a class library, we should first achieve the current goal.

The description of the current sb syntax can be viewed in the discussion area (if you are interested in jointly building a class library):

https://github.com/sannybuilder/dev/discussions/107

@87 @MatiDragon-YT Here I want to propose a corresponding function, the code preview function after decompilation. No matter which way we use classes, keywords, shorthands, or gta3sc to write cleo in the future, we will always use OP syntax as the standard. Then I think there is a shortcut key to view the preview function of the decompiled code of the current code. In fact, OP syntax is more conducive to beginners to understand the parameters and learn. In addition, not everyone has the foundation of high-level language. Programming beginners use keywords such as while if then else for, it is usually difficult to understand the structure of the loop, and OP syntax makes it easier for people to understand the loop structure. If you have the ability to preview the decompiled code, the easier it will be to learn. In addition, you can check the decompiled code in advance, and you can also check some problems in advance.

MatiDragon-YT commented 3 years ago

@XMDS I'm not saying that Sanny Builder is compatible with the syntax of other editors and/or IDEs, but that it can compile the Command Names that appear in https://gtagmodding.com/opcode-database/, since many times we emos wanted to use more than one opcode this way. The general idea would be for the IDE (Sanny Builder) to understand that this PRINT_BIG_FORMATTED is the same as this 0ACF. And I don't think there are many problems to implement them, because they are both written at the beginning of each line, and part of the code that was used for the acclaimed KEYWORDS could be used but without the need for them to appear in the autocomplete, although it would be good that they are highlighted with bold, to verify that they have been written well.


[...]In addition, not everyone has the foundation of high-level language. Programming beginners use keywords such as while if then else for, it is usually difficult to understand the structure of the loop, and OP syntax makes it easier for people to understand the loop structure[...]

Regarding all that, what you said there... Each way of programming has its advantages and disadvantages...

style advantages disadvantages
Opcode With the comments between the parameters, it makes them easy to use. It generates some confusion for beginners when decompiling old mods together with new mods, because of the comments that switch between them (including the language of the region where it was made). They hardly ever remember the IDE's tool for searching for opcodes and end up in forums asking for opcodes for extremely simple things.
Classe with Member Thanks to the fact that you can use them as a filter to classify a large number of things, it makes it very easy to access each opcode. Very easily, you can confuse the member of one class with that of another, causing problems to compile, as well as you can spend long periods of time wondering which member to use in a certain place, due to the scarce information.
Keyword As they are only used for opcodes with 1 or 2 parameters, it makes them very easy to remember and how to use them. The autocomplete bar changes size by itself many times, and if you don't want to have a long command list covering the entire screen, it is not recommended that you add more keywords to the .txt file
Command Name If you tend to confuse some classes or members of these, and you don't want to go looking for the XXXX: opcode, then maybe you can remember this option better. Being a somewhat more hidden function than keywords and having no helpful comments, it would only provide more comfort to advanced and great discomfort to beginners

Don't forget that Sanny Builder always asks how you want to decompile a script. If you don't like it, or don't understand how others encode, you can always opt for the decompile option without the source code, including an option to decompile without classes in the general options of the IDE ;)

XMDS commented 3 years ago

Isn't the SASCR mode of the current SB tool writing cleo scripts in GTA3sc (command name)?

XMDS commented 3 years ago

In addition, as I said, SB always regards OP syntax as the standard syntax for compilation and decompilation. Because they passed the SASCM.INI file, even in SCR mode. The settings of "Write Opcodes" and "Add additional information" can indeed affect the decompilation of scripts. But the problem is not here. For beginners without any programming foundation, OP syntax is currently the most suitable. It describes the meaning of the parameters in English in detail before each parameter and fully explains the meaning of the OP. The decompiled op code preview function I proposed can help players learn to use other syntax. For example, I currently use keywords (while if then) and class syntax to write cleo, but it is difficult for beginners to understand it. If there is a shortcut key to preview the decompiled OP code of the current code in advance, it is very beneficial Understand and write.

MatiDragon-YT commented 4 months ago

this feature is already in SB. i close the issue.