Difference between revisions of "Scripting basics"

From Soldat Community Wiki
Jump to: navigation, search
m (Fixed English grammatical errors throughout)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Story of Soldat Script Core=
+
=History of Soldat Script Core=
  
 
The '''Soldat Server Scripting Core''' was programmed by [[EnEsCe]] to help other users creating scripts for their server.  
 
The '''Soldat Server Scripting Core''' was programmed by [[EnEsCe]] to help other users creating scripts for their server.  
It use the Pascal coding language with '''Events''', '''Functions''' and '''Variables'''. You can find list of this coding part [[Server_Scripting|here]].
+
It uses the Pascal Programming Language with '''Events''', '''Functions''' and '''Variables'''. You can find a list of examples [[Server_Scripting|here]].
  
  
=Quick look at Pascal language=
+
=A Quick look at the Pascal Programming Language=
In quick glance, Pascal is quite useful and easy to manage compared to eg. C and C++ languages.
+
At a glance, Pascal is quite useful and easy to manage compared to eg. C and C++ languages.
Its use words (e.g. begin-end, if-or) instead of symbols ({-}) used in C/C++ so its easier to read. For basic script its doesn't need much work, most of text you can copy/paste, and its have very clear structure:
+
It uses words (e.g. begin-end, if-or) instead of the symbols ({-}) used in C/C++ so it is easier to read by the user. Basic scripting requires little work, most text you can copy/paste, and it has very clear structure:
 
  CONST
 
  CONST
 
   ();
 
   ();
Line 17: Line 17:
 
  END;
 
  END;
  
Another big plus of Pascal is its speed. Pascal compiler is lightning-fast and well-suited for teaching programming, you can do more in small time frame.  
+
Another big plus of Pascal is its speed. The Pascal compiler is lightning-fast and well-suited for teaching programming, as you can do more in a small time frame.  
Also there is less overhead and fewer ways for a new users to crash program. So as a first program language, Pascal its probably best choose.  
+
There is less overhead and fewer ways for a new user to crash a program. So as a first programming language, Pascal is a good choice.  
Even when world is filled with C++ and Java languages, Pascal, in his simplicity, is still one of the best programing language: Powerful and easy to handle.
+
Even in a world filled with use-cases for C++ and Java languages, Pascal, in its simplicity, is still one of the best programing language: Powerful and easy to handle.
  
  
 
=Tools for Writing a Scripts=
 
=Tools for Writing a Scripts=
Probably you expected that you need lost of programs and good PC to write Scripts for soldat, but don't worry, all you need is... Notepad.
+
You probably expected that you would need lots of programs and a high-end PC to write Scripts for soldat, but don't worry, all you need is... Notepad.
  
'''Yes. To write Scripts for [[Soldat]] you need just simple text editor that you can find in your system.'''
+
'''Yes. All you need to write Scripts for [[Soldat]] is a simple text editor that is already installed to your system.'''
  
  
  
But to help you, and improve your work, we recommend downloading [http://notepad-plus-plus.org Notepad++] just click [http://notepad-plus-plus.org/download/ here] to get latest version.
+
But to help you, and improve your work, we recommend downloading [http://notepad-plus-plus.org Notepad++] just click [http://notepad-plus-plus.org/download/ here] to get latest version. You can also use any other IDE.
  
Also to improve your work, we recommend downloading [http://forums.soldat.pl/index.php?action=dlattach;topic=40110.0;attach=27770 this file]
+
Also to improve your work, we recommend downloading [http://forums.soldat.pl/index.php?action=dlattach;topic=40110.0;attach=27770 this file] to aid in your Pascal programming.
  
 
Download it and put in your Notepad++ folder in ..\plugins\APIs
 
Download it and put in your Notepad++ folder in ..\plugins\APIs
Line 39: Line 39:
  
  
;What this Small Plugin do, you can see here:
+
;You can see what this small plug-in does here:
  
BEFORE:[[File:Notepad plusplus 01.jpg]] AFTER:[[File:Notepad plusplus 02.jpg]]
+
BEFORE:
 +
[[File:Notepad plusplus 01.jpg]]
 +
AFTER:
 +
[[File:Notepad plusplus 02.jpg]]
  
  
Its massively improve your work, its color all important parts of script and you can hide/show selected part of script(small + icons on the left)
+
It will massively improve your work with its syntax coloring and ability to hide/show selected code-blocks of your script (small + icons on the left)
  
  
 
=Online Pascal Tutorials=
 
=Online Pascal Tutorials=
:If you are interested in writing script for [[Soldat]] you should check few sites before you start messing with any '''Functions''' and '''Procedures''' :]
+
:If you are interested in writing scripts for [[Soldat]] you should check few sites before you start messing with any '''Functions''' and '''Procedures''' :]
  
  
Line 54: Line 57:
 
* [http://www.algonet.se/%7Ekhaan/tutor/ Turbo Pascal programming ]
 
* [http://www.algonet.se/%7Ekhaan/tutor/ Turbo Pascal programming ]
  
  Note: Some tutorials may have references to functions that do not exist in the scripting core.
+
  Note: Some tutorials may have references to functions that do not exist in the Soldat Scripting Core.
  
  

Latest revision as of 17:10, 2 December 2018

History of Soldat Script Core

The Soldat Server Scripting Core was programmed by EnEsCe to help other users creating scripts for their server. It uses the Pascal Programming Language with Events, Functions and Variables. You can find a list of examples here.


A Quick look at the Pascal Programming Language

At a glance, Pascal is quite useful and easy to manage compared to eg. C and C++ languages. It uses words (e.g. begin-end, if-or) instead of the symbols ({-}) used in C/C++ so it is easier to read by the user. Basic scripting requires little work, most text you can copy/paste, and it has very clear structure:

CONST
 ();
VAR
 ();
FUNCTION/PROCEDURE();
BEGIN
 ();
END;

Another big plus of Pascal is its speed. The Pascal compiler is lightning-fast and well-suited for teaching programming, as you can do more in a small time frame. There is less overhead and fewer ways for a new user to crash a program. So as a first programming language, Pascal is a good choice. Even in a world filled with use-cases for C++ and Java languages, Pascal, in its simplicity, is still one of the best programing language: Powerful and easy to handle.


Tools for Writing a Scripts

You probably expected that you would need lots of programs and a high-end PC to write Scripts for soldat, but don't worry, all you need is... Notepad.

Yes. All you need to write Scripts for Soldat is a simple text editor that is already installed to your system.


But to help you, and improve your work, we recommend downloading Notepad++ just click here to get latest version. You can also use any other IDE.

Also to improve your work, we recommend downloading this file to aid in your Pascal programming.

Download it and put in your Notepad++ folder in ..\plugins\APIs

eg. C:\Program Files\Notepad++\plugins\APIs

And after you start program just select in Language Tab: P->Pascal


You can see what this small plug-in does here

BEFORE: Notepad plusplus 01.jpg AFTER: Notepad plusplus 02.jpg


It will massively improve your work with its syntax coloring and ability to hide/show selected code-blocks of your script (small + icons on the left)


Online Pascal Tutorials

If you are interested in writing scripts for Soldat you should check few sites before you start messing with any Functions and Procedures :]


Note: Some tutorials may have references to functions that do not exist in the Soldat Scripting Core.


Soldat Scripting Tutorials

Our Soldat Community have prepared few easy tutorials for beginners, that should prepare you to write your first scripts for Soldat.
But don't worry. If you encounter any problem you can ask for help in our Forum in Scripting Discussions and Help section.