Batch Simple Plugin System Concept
Posted: 05 Jan 2014 15:21
Haha, Hey everyone.
Sorry I have been away for a while .
During the holiday I thought about learning C and building a plugin system for learning experience.
But I wondered if it was possible if I could make such a thing in batch, my apotheosis is that I can.
Sadly it would be very limited.
Let me explain how it would work. In the 'main' batch file you would have all the labels
main.bat:
and in the plugin.bat file we would make a function, the function can do anything:
plugin.bat:
Now the parameters work as follows:
We call the function 'function' in the plugin.bat with the parameter 'mainlabel', which is the name of the label this function 'function' is called in the main batch file, and optional parameter with the number i.e '2' is the 3nd line after the label 'mainlabel' in the main batch file for it to be called, this is separated buy a comma so you can use the function multiple times.
Just using that and some fancy code we can do this, as well as the main batch file calling the plugin file.
Building code for this 'experiment' and a plugin manager that is something similar to Notepad++'s plugin manager, downloading and updating etc.
So to call the plugin.bat batch file word work as follows:
In the simple plugin manager it would list all the batch files in a folder called plugins, which is in the root directory of the main batch file.
It will contain all these batch files and using a 'for' command it would call them.
e.g:
Sadly I do not have the batch file programming skill to build a system like this and I require help from the DosTips community.
It might take some time but we can do it, many people with batch file games can implement this into there batch file. e.g
The optimized batch Snake.bat can have this and others can make plugins such as score boards, etc, but obviously that would require to draw menus and stuff
So it is up to you guys, if you're up for the challenge I would gladly appreciate your help
Regards,
Adrianvdh
Sorry I have been away for a while .
During the holiday I thought about learning C and building a plugin system for learning experience.
But I wondered if it was possible if I could make such a thing in batch, my apotheosis is that I can.
Sadly it would be very limited.
Let me explain how it would work. In the 'main' batch file you would have all the labels
main.bat:
Code: Select all
:mainlabel
::1
::2
::3
:default
::1
::2
:settings
and in the plugin.bat file we would make a function, the function can do anything:
plugin.bat:
Code: Select all
:function
echo This is the test function that is shown in the main batch file :)
pause
call :function mainlabel 2, settings 5
exit /b
Now the parameters work as follows:
We call the function 'function' in the plugin.bat with the parameter 'mainlabel', which is the name of the label this function 'function' is called in the main batch file, and optional parameter with the number i.e '2' is the 3nd line after the label 'mainlabel' in the main batch file for it to be called, this is separated buy a comma so you can use the function multiple times.
Just using that and some fancy code we can do this, as well as the main batch file calling the plugin file.
Building code for this 'experiment' and a plugin manager that is something similar to Notepad++'s plugin manager, downloading and updating etc.
So to call the plugin.bat batch file word work as follows:
In the simple plugin manager it would list all the batch files in a folder called plugins, which is in the root directory of the main batch file.
It will contain all these batch files and using a 'for' command it would call them.
e.g:
Code: Select all
listing code...
call a%%
the variable 'a' is the names of all the batch files.
Sadly I do not have the batch file programming skill to build a system like this and I require help from the DosTips community.
It might take some time but we can do it, many people with batch file games can implement this into there batch file. e.g
The optimized batch Snake.bat can have this and others can make plugins such as score boards, etc, but obviously that would require to draw menus and stuff
So it is up to you guys, if you're up for the challenge I would gladly appreciate your help
Regards,
Adrianvdh