Results 1 to 9 of 9

Thread: "Scripting" language

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    "Scripting" language

    He guys,

    Still working on QDFPS (http://www.pascalgamedevelopment.com...p?14893-Qdfps/) and I wrote a little "scripting" language for this. The only thing you can actually do is set variables and execute procedures with up to 5 parameters so its pretty limited I use it for my console and for map scripts to load and set things while a map is loading. Syntax is a mix between pascal and c and there are and it supports booleans, integers, floats and strings as parameters. Strings however have some limitations which for me is fine since I only use them for paths. The code should be pretty self explanatory and it comes with a testbed. I though some other people might find it usefull.

    Luuk
    Attached Files Attached Files

  2. #2
    How about using PascalScript by RemoteObjects (might mess up name)? You'd be able to expose procedures, types and variables to scripts and scripts would be coded with Pascal with which you are familiar with?

    Granted, they are VCL/LCL-based, but you can create them in code or if you prefer visual approach, place them visually on data module and then create this data module (from my understanding all are non-visual).

  3. #3
    I actually used this for some of my previous projects. Works great but for what I need for this project its a bit to heavy.

  4. #4
    Ah, okay. If that's the case... I just thought you don't know about PascalScript.

  5. #5
    I redid the parsing of the commands:

    - 60% faster parsing
    - Better syntax checking
    - Less and cleaner code
    - Fix a load of small bugs

    Regards,
    Luuk
    Attached Files Attached Files

  6. #6
    Hi Luuk, nice work

    I just looked at your code, rather neat.

    I have coded an extra Params() function for a variable amount of params that you could use instead of using the multiple functions if you wish...

    Code:
    function Params(const p: array of TParam): TParams; overload;
    
    
    implementation
    
    {...}
    
    
    function Params(const p: array of TParam): TParams; overload;var
      i: Integer;
    begin
      setLength(Result,Length(p));
      for i := 0 to High(p) do
        result[i] := p[i];
    end;
    You would use it like so (adding any amount of params to the 'list' between the '[' and ']'):

    Code:
    Command('SetValues', @SetValues, Params([p(PT_BOOL), p(PT_INT), p(PT_FLOAT), p(PT_STR)]));
    cheers,
    Paul

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •