Oct 272009

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

EDIT: Updated 30/10/2009 – Forgot to add an extremely awesome new feature to the list. DrawAdvText!

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 DrawAdvText 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)”

* DrawAdvText *
Hmm… How to explain this one… Basically, this function will allow you to do the following:
o) Draw a Text string   -or-
o) Draw an Image to:    (built in client images, not custom)
a) Anywhere on the map, known as World XY.
b) Anywhere on the players screen, using 0.### as the XY position.
c) Anywhere on the players screen, while the F11 Server Menu is active.
Any text or image you draw will remain wherever you drew it until you call this function again with the Text parameter set to a blank string and the TextID of the one you want to remove. However, any world XY text/image will automatically be deleted on map change.
Confused? Yeah, you will have to wait until the official help page is published to understand everything such as the FontID’s and TextureID’s. I will provide a list and example of each on the manual page.

*** 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 ShooterParameter
procedure DoDamage(ID, Shooter: Byte; Damage: Integer);

* 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! Remember to leave a comment if you have anything to say relevant to this post!

P.S: I am trying out a new theme. Gone back to darker colours, makes preformatted text look much better. I didn’t like the way things looked previously, posting changelogs etc in default font format looked terrible. Leave a comment about the theme if you want.

Please don’t be a douche bag by copying my entire post and reposting it. Link directly to this post

33 Responses to “Script Core v3 Changelog”

  1. Hacktank says:

    Keep up the good work Ec. Cant wait for this update, many new and quite usefull fetures. But a few questions tho:

    1-) Does the ‘weapon’ paramater in onplayerkill and onplayerdamage give the weapon or bullettype, and what happens if it is a bullet made by createbullet that kills/does damage?

    2-) What exactly can setplayerstat do?

    3-) drawadvtext is awsome but as you said it only allows you to draw soldat-default images, will support for the sparcly mentioned ‘packages’ be added?

    Mouth is already watering :D.

  2. Curt says:

    A fairly useless suggestion: Ability to fetch the compilation time for a given script or current script. No I do not actually expect this to be implemented :P

  3. xurich says:

    Beautiful changes.

  4. VirtualTT says:

    It’s really glad to see that preprocessing is going to be available in the next script core version, definitely will make debugging of the scripts easier.
    It would be nice to see support for standard delphi global keywords
    Unit unit_name;
    Interface
    Implementation
    So the syntax checker will con complain about them. It will allow normal use of Lazarus IDE for scripts creation with all it’s features, such as syntax highlight, syntax checking, autocompletion, code auto styling etc. It’s possible right now, but the necessity to comment/uncomment those keywords all the time is annoying as hell…

  5. xmRipper says:

    EnEsCe, can you post the usage string of DrawAdvText function?
    Like “function DrawAdvText(blabla: string, blabla: byte … ): something;”

    • EnEsCe says:

      Nope, because I am still changing it around. I might split it into two functions. The name DrawAdvText seems a bit annoying to type, which can be bothersome when coding.

      • Curt says:

        Considering the description you gave, having separate functions:
        procedure DrawText(Id: byte; X, Y: cardinal; Text: string; Delay: integer; Colour: longint);
        procedure DrawTextWorld(Id: byte; X, Y: single; Text: string; Colour: longint);
        procedure DrawImage(…);
        procedure DrawImageWorld(…);
        or something similar to that
        (Initially I was thinking “Draw(Text|Image)(World|Screen)” but then I relized DrawTextScreen == DrawText, so I just removed the word “Screen”
        Plus the “BigTextID: Byte” which I left out should be in there.
        Or you could do a boolean which when true, Text is actually a filename for the image, otherwise is used as text (or vice-versa).
        I suggest having Delay, if 0, will stay there forever until either overridden (or map change for world)
        And I just realized I forgot about the F1 menu – maybe Draw(Text|Image)ScoreMenu(…);

        • Curt says:

          Forgot Delay in DrawTextWorld
          procedure DrawTextWorld(Id: byte; X, Y: single; Text: string; Delay: integer; Colour: longint);

        • EnEsCe says:

          It’s not the same kind of text drawing the current DrawText uses. DrawText uses the “big text” messages, whereas the text drawn by this new function is using all fonts, such as console, score board, etc. So both text forms cant be merged into DrawText alone

  6. Spkka says:

    \o/ Big up EnEsCe! Great additions

  7. xmRipper says:

    I hadn’t totally happy with new script core, until I saw DrawAdvText function.

  8. Gizd says:

    Those parameter changes are so hot I don’t mind changing all scripts.

  9. Waco says:

    Caring more about the traffic to your website than the community being informed of the changes.

    That’s fucking pro.

    • EnEsCe says:

      The community is being informed. The Script Core does not matter to everybody, only a small majority of people. That small majority visit my site regularly, and its their feedback I want. Not the Soldat Forums sort of feedback, where 8 out of 10 of the posts are people who have no idea what anything in the change log means, but still post saying “this is uber l33t, i wil so uze dis featurez on mah server which i dunt have! btw postcount+1!”, putting an annoying margin between the real feedback and the spam. The main post regarding Soldat 1.5.1 is going to be posted on soldat.pl, forums, and here.

      So go troll somewhere else.

      • Pavliko says:

        Lies! even the noob and the spammy posts helps..
        Don’t you get this good feeling when some retarded polish 12 yo say that this is nice!?!?!

  10. dnmr says:

    Sweet! Gotta start praying for the MySQL stuff to be more or less stable…

    As for the theme – no wrapping makes it kinda annoying to read the code block on smaller screens ( http://img687.imageshack.us/img687/5660/scscrollbar.png )

  11. CurryWurst says:

    Just want to say thanks for the effort your have spent into the new ScriptCore.
    There’s a great number of awesome features I very much appreciate.

    Keep up the good work EnEsCe!

  12. iDante says:

    So much amazing… This is awesome.

    What is the number_format function?

  13. Whooze says:

    When will u release 1.5.1b?

  14. croat1gamer says:

    microtime()
    Faster apponidle possibilities?

    • EnEsCe says:

      Nope, completely different from each other. Faster AppOnIdle calls = slower server. Microtime just gets the current time with microseconds.

      • croat1gamer says:

        :F

        Why dont you want to add such an option to the scriptcore, but simply make it “USE AT OWN RISK”
        Its not like that scripters dont know what to do with it, what can it cause, and what to do to prevent server slowing down.

        • EnEsCe says:

          Because you know everybody will use it, and it will become an extreme nuisance to hosts that run many servers such as myself. And then there is the slew of access violations it causes.

          • croat1gamer says:

            Ah, forgot it slows the whole computer, not just the application. :F

            What about making 2 versions of soldatserver?
            One which will be the “safe mode”, which will internally have the faster appondile disabled, which will be given to the server hosters, but if they want, they can use the not “safe mode” one, which will be the real soldatserver, with everything enabled.

          • croat1gamer says:

            Ah, forgot it slows the whole computer, not just the application. :F

          • croat1gamer says:

            oh, double (now triple) posted, i thought i was editing the comment

  15. Boblekonvolutt says:

    Apparently “Good job!” is too short…

  16. SpiltCoffee says:

    :o goody! can’t wait for the beta! :D

    “P.S: I am trying out a new theme. Gone back to darker colours, makes preformatted text look much better. I didn’t like the way things looked previously, posting changelogs etc in default font format looked terrible. Leave a comment about the theme if you want.” – Theme is interesting. feels slightly old school, yet the rounded corners steer me away from that thought…

    “Please don’t be a douche bag by copying my entire pots and reposting it. Link directly to this post” – Like asshat did?

    • EnEsCe says:

      Haha, if ‘asshat’ copied my entire post; then yes.

      The main thing I like about the new theme is its width. The old one was wrapping lines too much, and I can now see how sexy the comments look. The old ones were ugly. And now replies are nested with their original target rather than appearing as a regular comment.

  17. Scarface09 says:

    Are you talking about me EnEsCe? How I posted in Soldat Forums?

Leave a Reply

(required)

(required)

No prescription cialis online
Tramadol medication
Prescription propecia
Tramadol india
Cialis samples canada
Viagra ordering
Dosage of xanax
Xanax price per pill
Cheap 100mg viagra
Order xanax online
Online valium without prescription
Phentermine with no prescription
Viagra online cheap
Viagra online without prescription reviews
Levitra canada
Levitra samples
Buy cialis online from canada
Cheap phentermine without prescription
Buy viagra in england
Purchase phentermine without prescription
Xanax no rx
Propecia ireland
Viagra without prescription uk
Cialis ordering
Cialis over the counter
Generic viagra for sale
Cheap xanax bars
Cheap cialis soft tabs
Cheap tramadol cod
Where to buy phentermine cheap
Order tramadol overnight
Propecia uk pharmacy
Viagra purchase uk
Purchase tramadol online
Phentermine hcl without prescription
Discount viagra online
Buy viagra uk online
Where to buy cialis online
Xanax generic dosage
Buy viagra online in australia
Where to buy levitra online
Buy viagra online in ireland
Buy cheap viagra online uk
Cialis uk sales
Low price cialis
Cialis prices uk
Tramadol online no prescription overnight
Order tramadol cod
Viagra online shop
Phentermine 37.5 wholesale
Cialis 20mg
Xanax 1 mg dose
Overnight xanax delivery
Cialis order online
Viagra fast delivery
Phentermine buy australia
Viagra in france
Buy tramadol overnight
Prescription valium
40 mg prednisone side effects
Buy viagra online cheap
Xanax bars side effects
Cialis for sale
Buy phentermine 37.5mg online
Best prices for cialis
Propecia best prices
Viagra sale uk
Propecia price australia
Generic tramadol
Xanax no prescription required
Viagra discount prices
Propecia usa
Xanax with no prescription
Phentermine purchase online
Buy phentermine 37.5mg pills
Viagra in the philippines
Buy generic valium online
Viagra 50 mg online without prescription
Levitra 20mg
Levitra purchase
Buy tramadol cod

Cialis purchase online
Buying cialis
Blood pressure and prednisone
Purchase tramadol without prescription
Brand viagra cheap
Generic viagra 100mg
Propecia generic canada
Purchase cialis without a prescription
Low cost levitra
Viagra prescription cost
Buy cialis uk
Viagra 50mg side effects
Buy viagra 100mg
Propecia generic online
Genuine viagra online
Viagra professional online
Prednisone tablets 10 mg
Prednisone 40 mg