Author Topic: Script Core v3 Changelog  (Read 1116 times)

0 Members and 1 Guest are viewing this topic.

Offline scarface09

  • Veteran
  • *****
  • Posts: 1153
  • Arsenal Supporter For Life
Script Core v3 Changelog
« on: October 27, 2009, 04:42:50 am »
Article: http://enesce.com/370/soldat/script-core-v3-changelog/
Discussion should take place there in the comments.
Stop regurgitating his blog posts here.
~ jrgp




Alright, I think the ScriptCore changes are finalized now so its time for an update post.
Consider this the “Function/Event Parameter Changes” warning.

Today I am going to post the full ScriptCore v3 Changelog (Soldat 1.5.1) only, and discuss as much as I can about each change.

First of all, the changelog.
- Fixed vote starting functions not working
- Fixed access violation spam when an admin connects before the Script Core has compiled initially
- Added PreProcessing to the ScriptCore Compiler. Standard directives INCLUDE, DEFINE, UNDEF, IFDEF, IFNDEF, ENDIF are supported.
- Added WIN32, LINUX, and SAFEMODE to preprocessing definitions
- Added ScriptCore Compiler will now display compilation time in microseconds for individual scripts and overall
- Modified ScriptCore Compiler will now display hints/warnings during compilation without requiring there to be an error as well.

- Added time function
- Added MySQL functions
- Added SQLite functions
- Added OnGameEnd event to NetworkCore.pas
- Added SecAmmo stat to the GetPlayerStat function
- Added Port stat to the GetPlayerStat function
- Added SetPlayerStat function
- Added booltostr function
- Added microtime function
- Added BigTextID parameter to DrawText (after ID)
- Added OnFlagDrop event to NetworkCore.pas
- Added DeactivateServer event to Core.pas
- Added ARGB function
- Added Randomize function
- Added IntInRange, Int64InRange, and FloatInRange functions
- Added MoveFile, DeleteFile, and CopyFile functions.
- Added number_format function
- Added VarToStr function
- Added VarType function
- Added WeaponNumByName function
- Added ‘Registered’ stat to GetPlayerStat function
- Added BattlEyeEnalbed global variable
- Added HighestID global variable
* PreProcessing *
Many Scripter’s probably won’t need this, but it is a standard of any script engine which I forgot to include. So its there now, just in case. If used correctly, it can greatly help development.
* Compilation Time *
Just for benchmarking purposes to see how optimized your script is, as far as compilation is concerned. You can use the new microtime() function to benchmark your own functions at run-time.
* MySQL Functions * (What is MySQL?)
As requested, MySQL functionality has been implemented. I tested it as much as possible, and seems pretty fast. You will be able to open up as many MySQL connections as you want at the same time, but I would recommend only having 1 persistent connection. Opening a new connection for every query is bad, mmkay? Everybody that would use these functions probably knows that, but I am just making sure. Scripter’s, make sure you always keep in mind that your MySQL scripts are easily exploited if you don’t properly format your queries, using the mysql_escape_string(input) function. The Official Scripting Manual will include all the MySQL functions, and an example script. The manual update will go live when the Public Beta begins.
* SQLite Functions * (What is SQLite?)
Same as above really. SQLite performance is much faster than MySQL, but you can only open up one SQLite database at a time, per server. All vital functions are there, including the ability to begin Transactions. The Official Scripting Manual will include all the SQLite functions, and an example script. The manual update will go live when the Public Beta begins.
* SetPlayerStat *
Just a basic function really. It is not (and can not) be as advanced as people keep requesting it to be, due to how the game works. But it has the basics, and room for expansion in the future.
* BigTextID parameter on DrawText *
As we all know, using DrawText overwrites all the standard game messages such as ‘You killed Major’, ‘Bravo Team Scores’ etc. But I modified the Soldat client to have room for up to 3 “Big Text” messages, and added this parameter. All standard game messages use ID 1, so you can use 2 and 3 freely and not worry about overwriting. You can still overwrite them, of course.
* MoveFile, DeleteFile, and CopyFile *
Really don’t know why I never included these in the first Script Core release… But anyway, here you go. Some restrictions apply, you may not do anything involving the soldatserver binary and you may not use directory traversal (../../).
* VarToStr *
Automatically detects the type of a variable, and prints it as a string. Added to make debugging and developing scripts easier, however please do not EVER use this function for non-debugging purposes! It is very slow compared to regular inttostr, floattostr etc functions. If I see people releasing scripts using this function due to sheer laziness, it will be removed. There is also the VarType function to help. So you can do stuff like “If VarType(1000) = varInteger then inttostr(1000)”

*** FUNCTION AND EVENT PARAMETER CHANGES ***
I warned you it was coming! The following changes will break all existing scripts that use the functions/events listed below. Scripter’s will be required to update their script to comply with these changes, thank you for your understanding :)

* GetURL = Added TimeOut Parameter
function GetURL(URL: string;TimeOut: byte): string;
TimeOut has been added to specify the number of seconds until a GetURL request will timeout.
* DrawText = Added BigTextID Parameter
procedure DrawText(ID, BigTextID: Byte; Text: string; Delay: Integer; Colour: Longint; Scale: Single; X, Y: Integer);
* OnRequestGame = Added TSTR, Port, and ForwardedRequest Parameters
function OnRequestGame(TSTR, IP: string;Port:Word;ForwardedRequest: boolean;State: integer): integer;
Don’t ask what TSTR is, just add it. ForwardedRequest is a simple true/false if the request came from a ForwardClient() call.
* OnPlayerDamage = Added Weapon Parameter
function OnPlayerDamage(Victim, Shooter: byte; Damage: integer;Weapon: byte): integer;
Enjoy :)
* OnPlayerKill = Changed Weapon Parameter from String to Byte
procedure OnPlayerKill(Killer, Victim: byte; Weapon: byte);
To get in sync with the extra parameter on OnPlayerDamage. You can use the new WeaponNumByName(wep) function to convert the old names to their number,
* ThreadFunc = Added ScriptName Parameter
procedure ThreadFunc(Params: array of Variant; FuncName, ScriptName: string);
Hard to explain this one really. Basically ThreadFunc currently calls FuncName in every script running on the server, which is bad for speed. So now it needs that paremter to only call the function in your script.
* DoDamage = Added Shooter Parameter
procedure DoDamage(ID, Shooter: Byte; Damage: Integer;DamageType: byte);
* DoDamageBy = Removed
Removed this function because it was redundant due to the above change.
* BanPlayer = Added Reason Parameter
procedure BanPlayer(num: byte; time: integer; Reason: string);
* BanPlayerReason = Removed
Removed this function because it was redundant due to the above change.

And that’s all of the ScriptCore changes. The manual will be updated with the new functions and changes once the Public Beta begins, which will be very soon. My next post will be very juicy regarding Soldat 1.5.1, so keep checking back!
« Last Edit: October 27, 2009, 09:11:56 pm by jrgp »
Football is the other face of the world. If you don't like it, then you can get the hell out!

Offline Shard

  • Camper
  • ***
  • Posts: 449
  • yeet
Re: Script Core v3 Changelog
« Reply #1 on: October 27, 2009, 06:38:49 pm »
So, is this better or worse? I don't understand half of this. Help me.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Re: Script Core v3 Changelog
« Reply #2 on: October 27, 2009, 08:23:41 pm »
So, is this better or worse? I don't understand half of this. Help me.

He just c**tpasted the changelog for the Soldat server's scripting abilities from eC's blog post: http://enesce.com/370/soldat/script-core-v3-changelog/

I really, really wish that eC would just come here and post this stuff himself.

edit:
<@EnEsCe> if I posted it on forums, all the replies would be from idiots; whom of which I dont want polluting my posts; and I put effort into my posts so I want my site to get the traffic from my effort.
« Last Edit: October 27, 2009, 09:12:52 pm by jrgp »
There are other worlds than these