You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CLEO and its successors add many new custom opcodes (see #71 for example). Currently in order to compile the script you have to alter the original *SCM.INI and add new definitions manually. This is error-prone and unfriendly to new users. During Sanny updates those changes could be lost so you need to update the INI again.
Need to come up with a flexible solution that make Sanny aware of custom opcodes without (ideally) touching its files. This affects the compiler, the disassembler, and IDE (Opcode Search).
These are some of the solutions that I would give you if I could
In the same way that modes.xml works, you could do something similar to load new opcodes.txt and SASCM.INI with other names, such as opcodeOfCLEO.txt or newOpc.txt from the mode folder.
Personally, I don't like XML because of its novice-unfriendly syntax.
Write two new files e.g. XXX and ZZZ, for custom opcodes if they don't exist, but incase that these files if they exist, only read files XXX and ZZZ existing.
Could add a tool with an interface similar to "User Tools" and thus make it a little more pleasant.
Closer to the point, changes to the SCM.ini definitions would influence all of the "command" files, which I've been grouping to include:
classes.db
keywords.txt
opcode.txt (examples.txt)
scm.ini (opcodes.ini)
templates.txt
(I've been considering renaming some files to be more consistent with the XML definitions, and between all games.)
See: Mobile Modes for GTA3 and Vice City #6 - A little feedback would be appreciated.
For keywords in particular, but also CustomVariables.ini, it would nice to be able to have secondary files with duplicate entries that worked in the compiler, but consistently disassembled to the primary example. #20
Thinking ahead to enumerations; I have found it difficult to maintain a long list in constants.txt built around sheets for each group. I would much prefer to manage these groups as individual files. #40
I agree with @MatiDragon-YT 's assessment of the awkwardness of managing the XML mode files. I have given serious consideration to creating a Modes Manager as a learn-to-GUI project with my son, but that's not going to happen any time soon. Neither of us has done this before and, well... he agreed but has shown no interest in starting. I think a better strategy is to allow the user, or ToolPacks, to update files in a manner that doesn't need to modify the XML file.
Well.. it would not be bad to start like this.
in the future, maybe I can generate a simple console program that does that job, that of installing new extensions to XML.
A GUI tool that allows to add/remove new entries to modes.xml by just dropping a new file onto the tool window and/or unticking a checkbox to temporarily exclude the file would be really handy.
I agree XML is not the most human-friendly format, yet it's much easier comparing to awkward custom syntax of the classes.db.
Before I forget again... I was not able to find an error case for the same keyword text being assigned to different opcode numbers.
I think an Edit Mode Manager tool is an awesome idea worthy of it's own discussion, but doesn't solve the stated goal of:
Need to come up with a flexible solution that make Sanny aware of custom opcodes without (ideally) touching its files.
Suggestion for a Mode Manager progression:
V1 - A tool for switching the current modes.xml file. User Tools appear to be limited to 9 entries. I'm already using 5 just for this purpose. This version would not need to modify xml files.
V2 - Ability to copy, paste, disable. delete and sort entire mode definitions. For example. copy a PS2 edit mode from a custom root mode to Sanny's default root mode. Or, duplicate a standard edit mode and update the the title and IDs to support different game paths needed for multiple installations of the same game.
-V3 - A full featured Mode Editor. I figure that mode editing will always be an advanced skill. Ideally, a novice would never need to use the editing features.
While working on adding CLEO library and its plugins definitions in different edit modes I realized that providing all possible opcodes by default could be misleading and unintentionally make a scripter assume they use an instruction that is available with vanilla game but in fact this is something that requires an extra piece of software. While it's obvious in context of {$CLEO} scripts that you might want to use CLEO opcodes , it's not like that in main.scm or when you use opcodes introduced with some exotic plugins. You should be aware of such dependency on third-party software and explicitly signal Sanny Builder you want to use it.
Hence comes something new in edit modes - the extensions.
What is an extension? It's a named set of files that define new instructions and related language constructs (keywords, classes).
Each edit mode could have multiple extensions but it must have at least one which would be used with any script. In other words this is what edit modes currently define using <opcodes>, <keywords> , <examples>, etc. So, say, GTA SA v1.0 mode could now look like:
Now the interesting part. By default the IDE and compiler will only use the default extension. This is something that belong to the game opcodes and is always available for the given game. But if you want to use something extra you should add a new line on top of your script: {$use extension_name}. E.g.:
{$use cleo+}
{$use newOpcodes}
Now both the IDE and compiler know your intention and will provide necessary support (autocomplete, highlighting, compiling). The disassembler will be smart enough to restore list of extensions based on which opcodes are actually used in the file.
Using {$CLEO} directive implies {$use cleo} so no changes needed for existing scripts.
The above is only necessary for the scripter. A compiled script will continue depend on the presence of CLEO plugins on user's machine so it's a responsibility of the script author to announce them. However in the future we could integrate some kind of dependency check in the CLEO itself, so it reject scripts if required plugins are missing, to avoid game crashes.
We could also agree on some implicit way of adding extensions, for example, have a subfolder inside edit mode directory named extensions where you create a new folder, say, cleo+ and add new files here:
Also have to support conflicting extensions when one opcode number belongs to multiple extensions. Example: clipboard operations plugin & cleo+. The compiler should suggest all possible choices. The disassembler should somehow resolve the correct extension, possibly by analyzing the rest of opcodes used if they belong to the same extension.
@x87 The function of extended commands is really great.
Just as I replied to you in the forum a few hours ago. I suggest to distinguish between the original OP and the non-original OP. Just as the default original OP uses {$CLEO}, the OP added by the standard CLEO library should be {$CLEO4} and {$CLEO2.0}. This is actually better. In fact, with regard to the OP search bar, whether there is a switch hotkey, switch the search bar of the corresponding type OP according to the extension of the OP.
About the default "keywords",I noticed that this file is still messy. In fact, the original keyword "if jf wait." and so on appeared for abbreviation, but some OPs about CLEO4 and CLEO+ added in the 3.6.0 keywords are very messy. I mean actually maybe now we are not creating it for shorthand? Then it is necessary to distinguish between several types of OP keywords. As you said, we should create multiple files separately. I also noticed a problem:
They are not the same. I think it should be standardized as one kind, just like GTA3sc:
0A96: 0@ = get_ped_pointer 1@
0A97: 0@ =get_vehicle_pointer 1@
0A98: 0@ =get_object_pointer 1@
I think the keyword is not necessarily a shorthand for OP, so it can be more standardized. Not only these three OPs, other OPs also have problems.
But are you planning on adding FYP's SAMPFUNCS extension to your defined sets of extension?
I don't have such plans. The goal is to make the process of adding new extensions as easy as just copying a folder into Sanny Builder data directory. If anyone is interested to convert SAMPFUNCS into a proposed format they could do so and distribute as a prepared package.
I don't want to bear a burden of maintaining all known opcode plugins.
Aldrin-John-Olaer-Manalansan commented on Dec 11, 2020
I'd like to push this idea forward and start off of a conservative approach. Given a number of challenges we could limit the proposal to the following:
allow multiple <opcodes> definitions.
<opcodes>@sb:\data\vc\opcodes.ini</opcodes>
<opcodes>@sb:\data\vc\plugins\*.opcodes.ini</opcodes> // not sure about wildcard support
Each file overwrites previous definitions in case of id clashes. To resolve the clash differently, reorder the <opcodes>.
allow self-declarative mode folders. Instead of defining each mode in modes.xml, a user could create a new folder under SB\data, place a file called mode.xml (same format as <mode> in modes.xml), and select it from SB's list of modes.
Each mode could still extend an existing mode with <extends>. In addition to the mode id, an argument could be a path to mode.xml of the mode to extend (i.e. extends="../sa/mode.xml")
Users can delete modes they are not interested in (another solution to Edit Mode list customisation #184), either by deleting the folder or renaming mode.xml file
Users can delete modes they are not interested in (another solution to #184), either by deleting the folder or renaming mode.xml file.
My thought was to add a data\disabled folder for edit modes I don't intend to use regularly.
A user could quickly get into trouble by disabling modes that are extended. And renaming mode.xml seems likely to cause similar issues.
Still, I like the basic idea of making custom edit modes easier to implement. I've been putting off customizing my edit modes since it tends to lead to conflicts when sharing scripts. Perhaps it's time to revisit the idea to provide examples for the new feature.
Got any thoughts on implementing original variable names for SA?
Activity
MatiDragon-YT commentedon Sep 23, 2020
These are some of the solutions that I would give you if I could
opcodes.txtandSASCM.INIwith other names, such asopcodeOfCLEO.txtornewOpc.txtfrom the mode folder.XXXandZZZ, for custom opcodes if they don't exist, but incase that these files if they exist, only read filesXXXandZZZexisting.OrionSR commentedon Sep 24, 2020
Oh wow! Good idea. And is an appropriate issue for the question I had in mind.
Are Restored Opcodes currently supported by Sanny?
Closer to the point, changes to the SCM.ini definitions would influence all of the "command" files, which I've been grouping to include:
(I've been considering renaming some files to be more consistent with the XML definitions, and between all games.)
See: Mobile Modes for GTA3 and Vice City #6 - A little feedback would be appreciated.
For keywords in particular, but also CustomVariables.ini, it would nice to be able to have secondary files with duplicate entries that worked in the compiler, but consistently disassembled to the primary example. #20
Thinking ahead to enumerations; I have found it difficult to maintain a long list in constants.txt built around sheets for each group. I would much prefer to manage these groups as individual files. #40
I agree with @MatiDragon-YT 's assessment of the awkwardness of managing the XML mode files. I have given serious consideration to creating a Modes Manager as a learn-to-GUI project with my son, but that's not going to happen any time soon. Neither of us has done this before and, well... he agreed but has shown no interest in starting. I think a better strategy is to allow the user, or ToolPacks, to update files in a manner that doesn't need to modify the XML file.
Goal: To update the edit mode the user would only need to place a file with the appropriate naming convention into the proper folder.
MatiDragon-YT commentedon Sep 26, 2020
Well.. it would not be bad to start like this.
in the future, maybe I can generate a simple console program that does that job, that of installing new extensions to XML.
x87 commentedon Sep 26, 2020
A GUI tool that allows to add/remove new entries to modes.xml by just dropping a new file onto the tool window and/or unticking a checkbox to temporarily exclude the file would be really handy.
I agree XML is not the most human-friendly format, yet it's much easier comparing to awkward custom syntax of the classes.db.
OrionSR commentedon Sep 26, 2020
Before I forget again... I was not able to find an error case for the same keyword text being assigned to different opcode numbers.
I think an Edit Mode Manager tool is an awesome idea worthy of it's own discussion, but doesn't solve the stated goal of:
Suggestion for a Mode Manager progression:
-V3 - A full featured Mode Editor. I figure that mode editing will always be an advanced skill. Ideally, a novice would never need to use the editing features.
x87 commentedon Nov 8, 2020
While working on adding CLEO library and its plugins definitions in different edit modes I realized that providing all possible opcodes by default could be misleading and unintentionally make a scripter assume they use an instruction that is available with vanilla game but in fact this is something that requires an extra piece of software. While it's obvious in context of
{$CLEO}scripts that you might want to use CLEO opcodes , it's not like that in main.scm or when you use opcodes introduced with some exotic plugins. You should be aware of such dependency on third-party software and explicitly signal Sanny Builder you want to use it.Hence comes something new in edit modes - the extensions.
What is an extension? It's a named set of files that define new instructions and related language constructs (keywords, classes).
Each edit mode could have multiple extensions but it must have at least one which would be used with any script. In other words this is what edit modes currently define using
<opcodes>,<keywords>,<examples>, etc. So, say, GTA SA v1.0 mode could now look like:In addition to the default extension the mode could define custom extensions, e.g. one for standard CLEO opcodes:
or any other CLEO plugin:
Now the interesting part. By default the IDE and compiler will only use the default extension. This is something that belong to the game opcodes and is always available for the given game. But if you want to use something extra you should add a new line on top of your script:
{$use extension_name}. E.g.:Now both the IDE and compiler know your intention and will provide necessary support (autocomplete, highlighting, compiling). The disassembler will be smart enough to restore list of extensions based on which opcodes are actually used in the file.
Using
{$CLEO}directive implies{$use cleo}so no changes needed for existing scripts.The above is only necessary for the scripter. A compiled script will continue depend on the presence of CLEO plugins on user's machine so it's a responsibility of the script author to announce them. However in the future we could integrate some kind of dependency check in the CLEO itself, so it reject scripts if required plugins are missing, to avoid game crashes.
Please let me know your thoughts on this feature.
x87 commentedon Nov 8, 2020
We could also agree on some implicit way of adding extensions, for example, have a subfolder inside edit mode directory named
extensionswhere you create a new folder, say,cleo+and add new files here:Sanny would automatically register a new extension as if it was defined explicitly in the modes.xml
x87 commentedon Nov 9, 2020
Also have to support conflicting extensions when one opcode number belongs to multiple extensions. Example: clipboard operations plugin & cleo+. The compiler should suggest all possible choices. The disassembler should somehow resolve the correct extension, possibly by analyzing the rest of opcodes used if they belong to the same extension.
XMDS commentedon Nov 13, 2020
@x87 The function of extended commands is really great.
Just as I replied to you in the forum a few hours ago. I suggest to distinguish between the original OP and the non-original OP. Just as the default original OP uses {$CLEO}, the OP added by the standard CLEO library should be {$CLEO4} and {$CLEO2.0}. This is actually better. In fact, with regard to the OP search bar, whether there is a switch hotkey, switch the search bar of the corresponding type OP according to the extension of the OP.
About the default "keywords",I noticed that this file is still messy. In fact, the original keyword "if jf wait." and so on appeared for abbreviation, but some OPs about CLEO4 and CLEO+ added in the 3.6.0 keywords are very messy. I mean actually maybe now we are not creating it for shorthand? Then it is necessary to distinguish between several types of OP keywords. As you said, we should create multiple files separately. I also noticed a problem:
In OP.ini and OP.txt:
0A96: $ActorStruct = ped $PLAYER_ACTOR struct
0A97: $CarStruct = vehicle $MyCar struct
0A98: $ObjectStruct = object 0@ struct
Keyword file:
0A96=get_ped_pointer
0A97=get_vehicle_pointer
0A98=get_object_pointer
They are not the same. I think it should be standardized as one kind, just like GTA3sc:
0A96: 0@ = get_ped_pointer 1@
0A97: 0@ =get_vehicle_pointer 1@
0A98: 0@ =get_object_pointer 1@
I think the keyword is not necessarily a shorthand for OP, so it can be more standardized. Not only these three OPs, other OPs also have problems.
24 remaining items
x87 commentedon Dec 11, 2020
I don't have such plans. The goal is to make the process of adding new extensions as easy as just copying a folder into Sanny Builder data directory. If anyone is interested to convert SAMPFUNCS into a proposed format they could do so and distribute as a prepared package.
I don't want to bear a burden of maintaining all known opcode plugins.
Aldrin-John-Olaer-Manalansan commentedon Dec 11, 2020
I can create all definitions of SAMPFUNCS Extension for the upcoming Sanny Builder version.
For the mean time, I will wait for the final proposed format.
x87 commentedon Dec 11, 2020
@Aldrin-John-Olaer-Manalansan Ok. Can you please open a new ticket for this request similar to #71?
Aldrin-John-Olaer-Manalansan commentedon Dec 11, 2020
Requested ticket #112
x87 commentedon Jan 12, 2021
Moving this ticket out of v3.7 as I need more time to come up with a solution to some cases.
x87 commentedon Jan 15, 2021
@OrionSR
they are now as of https://github.com/sannybuilder/dev/releases/tag/v3.7.0-alpha.3
x87 commentedon Jun 7, 2023
I'd like to push this idea forward and start off of a conservative approach. Given a number of challenges we could limit the proposal to the following:
<opcodes>definitions.<opcodes>.modes.xml, a user could create a new folder under SB\data, place a file calledmode.xml(same format as<mode>inmodes.xml), and select it from SB's list of modes.<extends>. In addition to the mode id, an argument could be a path to mode.xml of the mode to extend (i.e.extends="../sa/mode.xml")OrionSR commentedon Jun 7, 2023
My thought was to add a data\disabled folder for edit modes I don't intend to use regularly.
A user could quickly get into trouble by disabling modes that are extended. And renaming mode.xml seems likely to cause similar issues.
Still, I like the basic idea of making custom edit modes easier to implement. I've been putting off customizing my edit modes since it tends to lead to conflicts when sharing scripts. Perhaps it's time to revisit the idea to provide examples for the new feature.
Got any thoughts on implementing original variable names for SA?
x87 commentedon Jun 7, 2023
you mean #195? Haven't looked closely yet, sorry.
x87 commentedon Sep 9, 2023
closing as the limited proposal has been implemented in 3.9.0