Jump to content

Recommended Posts

7add69a8c6ee57cbaa2b6d5203fded75.png

SQF-VM

The SQF emulator

A fully working, open-source Virtual Machine for the scripting language of the ArmA Games.

Links

 

FAQ

  • How to use this thing?
    To start using the SQF-VM, you just have to double click the executable.
     
  • What can it be used for (examples)?
    Most obvious example is: you are using a laptop while traveling and wanna test some SQF code.
    More advanced users might even use this for unit-testing their code.
     
  • Are there command line parameters available to eg. use this for unit-testing?
    Yes, there are. To get all, start the tool via command line and the parameter -?
     
  • How to use the debug interface?
    There is documentation available on the github page inside of Documentation/Debugger.
     
  • What is supported?
    To check what currently is supported and what is not, you can use the `help__ "name"` command.
    If it outputs proper descriptions, the command is fully supported.
    If it does not, then the command is not yet implemented sadly.
     
  • I found a bug, what shall i do now?
    Try to narrow down the problem as much as you can and then head over to the github issues section to report the bug.
     
  • I got a question that is not answered in here, what to do?
    Ask your question in this thread or in the discord channel and i might add it to this list 🙂

 

Downloads

    All releases can also be found inside of the releases section of the github repository.

 

Changelog

1.0-RC1
    -/-

 

  • Like 13

Share this post


Link to post
Share on other sites

Wow. What can it be used for? Programming Windows applications in SQF?

Share this post


Link to post
Share on other sites
50 minutes ago, engima said:

Wow. What can it be used for? Programming Windows applications in SQF?

 

I've been using for testing SQF when not on a PC with arma, someone else suggested it could be used for unit testing and scripts you make too.

Share this post


Link to post
Share on other sites

0.1.1 will be released next monday (04.09.2017) containing fixes for memory leaks, new commands, fixes for existing commands and a new switch to modify the max instructions limit (also included: non-sqf commands will be suffixed by a __ --> `help` will be renamed to `help__`)

0.2.0 will then hopefully be released the week after again on monday (11.09.2017) which then will contain first object stuff

 

 

6 hours ago, engima said:

Wow. What can it be used for? Programming Windows applications in SQF?

in theory, one could do that

just need to add the required commands for interaction with win-api

Share this post


Link to post
Share on other sites

So if I have a script that let's say spawns and removes units at certain distance from the player, can I run that in your VM and monitor what happens (that a unit is really removed as it is supposed to) when the player moves away? I mean, I would need to input the player's behavior, like position and direction and such things, since the script is made to react to it. Can I do that for example by spawning a "player thread".

 

If I have a script that makes an AI unit do something when it detects the player (knowsAbout > 0). Are you emulating such events? Or where have you set the borders? It would be awesome, but is it doable without help from the actual game engine?

Share this post


Link to post
Share on other sites
1 hour ago, engima said:

So if I have a script that let's say spawns and removes units at certain distance from the player, can I run that in your VM and monitor what happens (that a unit is really removed as it is supposed to) when the player moves away? I mean, I would need to input the player's behavior, like position and direction and such things, since the script is made to react to it. Can I do that for example by spawning a "player thread".

 

If I have a script that makes an AI unit do something when it detects the player (knowsAbout > 0). Are you emulating such events? Or where have you set the borders? It would be awesome, but is it doable without help from the actual game engine?

 

you would need to make the AI object know about the player, same with movement (there will be special vm-specific commands for that)

 

right now, spawn is not possible at all btw.

Share this post


Link to post
Share on other sites

Ok, I guess there's a reason you give it version 0.1. :) But it is a very interesting idea! Nice work!

Share this post


Link to post
Share on other sites
6 hours ago, engima said:

Ok, I guess there's a reason you give it version 0.1. :) But it is a very interesting idea! Nice work!

well ... whole project started on August 21st so ... yes :don11:

Share this post


Link to post
Share on other sites

Hi Folks,

 

Intriguing - as someone who tries to write scripts while I travel on my laptop - sans ArmA - this might be really helpful...

 

Great idea - I'll have to take a gander...

 

Thanks...

 

Regards,

Scott 

Share this post


Link to post
Share on other sites

Version Alpha 0.1.1

 

Highlights:

  • Code is now pre-parsed instead of parsing it when code_load instruction is executed
  • DBGINF structure is now holding the code hint directly
  • new command line parameter -s
  • Fixes and more
  • new commands: %, ^, pushBack, set, isEqualTo, !, comment

Full Changelog:

fixed strcmpi undefined
fixed warnings
fixed sm_get_value_index function
Added isEqualTo
Fixed warnings
renamed `COUNT` type to `COUNT__`
renamed `help` command to `help__`
Fixed issue caused by deallocated commands in code stacks on global variables
Cleaned up files
removed comment
Improved code_type performance
Added c function to compare two items for equality
Added set command
only admins now can execute commands
Added pushBack command
<ARRAY> select <ARRAY-SIZE> now properly pushes a nothing to the stack
Fixed empty value assignment crashing
Merge branch 'master' of https://github.com/X39/sqf-vm.git
fixed bot
replaced test 2k with 0
fixed index out of range for select; fixed zero divisor
fixed max length for buffer
Added decode to string to remove python bullshittery nonsense
fixed bot
added missing ')'
fixed python bot
removed unneeded vars
code fix
more code fixes
further fix
fixed error declaration & renamed to orig_error
Fixed buffer passing
fixed syntax
replaced tabs with spaces
updated python bot
Moved commands into separate file, added special print function to sqfvm
fixed format stringifying strings
removed unneeded variables from cmd_comment
fixed empty string concat
Now always including <limits.h>
Merge branch 'master' of https://github.com/X39/sqf-vm.git
fixed entry.c for gcc
Fixed MemoryLeaks
removed module feedparser
Added -s param to change the max instructions limit
fixed command callback ptr of comment function
added `comment` command
Added comment support to tokenizer
Added ^ and % to tokenizer
Added ^ command
Added alternative syntax to and & or
Added mod alias `%`
Fixed description of atan2, min, max and mod
fixed mod, max, min and atan2 being registered as unary commands instead of binary
Added `!` unary command
Updated help texts
changed build name

 

Share this post


Link to post
Share on other sites

next weeks update is on track already

 

new commands in the github (and discord bot) for today: position, getPos, setPos, velocity, setVelocity, createVehicle, getVariable, setVariable

Share this post


Link to post
Share on other sites

https://github.com/X39/sqf-vm/releases/tag/0.1.2-alpha

 

Added more checks to FOR
fix
re-fixed endless attempt to parse empty blocks
Added Switch case do
Added ForEach
fixed parser
fix
Moved OBJECT type into its own file
fixed array parsing
Fixed array order
Added productversion
added missing comparison types to ==, added !=
Added velocity and setVelocity
Added getPos, position and setPos
Added typeOf
added setVariable & getVariable
malloc sizeof from pointer to actual struct
fixed invalid malloc sizeof
fixed copy-paste error
Added createVehicle
Added OBJECT type
fixed last token getting proper textrange info
fixed empty string not terminated segfault
unterminated strings are no longer trimmed by 2 chars
Added COUNT type to vm types

 

next release can be expected to contain sides & groups

Share this post


Link to post
Share on other sites

quick status update on ... well ... the update :dozingoff:

 

Getting progress done but not as much as i hoped ... thats why the update of this week also is delayed till next week (discord bot is as usual up-to-date with latest version available)

 

the range of planned features did not changed

 

 

 

I also will introduce an unary variant of the help__ command that outputs stuff like this (here for the command itself):

<NULLAR> help__
    Description:
        Displays this help text.
    Usage:
    Examples:
        help__ //nil

<UNARY> help__
    Description:
        Outputs information to given command. Expects a <STRING> on righthand. Usage: help__ "command"
    Usage:
    Examples:
        help__ "typeOf"//nil

 

Share this post


Link to post
Share on other sites
3 hours ago, Ilias48rus said:

Why " help__ " and " _help " ?

(hope question not too stupid)

mistake of mine

 

obviously `help__` :3

all those examples are hand-written thus typos etc. might occur

wont be in release though (and edited the post)

  • Like 1

Share this post


Link to post
Share on other sites

next release also will contain the `params` command

Share this post


Link to post
Share on other sites

Release 0.1.3-alpha

also posting (again) the link to the discord of the sqf-vm https://discord.gg/b5qCUCK where the bot variant is available in

0.1.3-alpha
    Added allGroups nullar
    Added createUnit and units command
    fix
    Added groupId command and fixed stuff related to commits since adding deletevehicle
    added createGroup and deleteGroup
    enhanced examples for isNil
    Added deleteVehicle
    fixxed memory leak on call to deleteInner
    Implemented isNil
    Added params command
    fixed if unary command has binary version and is on righthand side of assignment the binary one would be picked
    altered instruction count note
    now using vm->stack for all errors in *_stack functions
    fixed crash when assigning empty to variable (due to code block ending with assignment)
    fixed crash when assigning empty to variable (due to code block ending with assignment)
    fixed segfault on large print output due to alloca usage
    Added instruction count output to sqf-vm
    fixed order of array-creating commands being inversed
    removed duplicate declaration of arr
    Replaced instruction adding of arrays by array_push calls
    No more tailing zeros
    fixed error on invalid type for toString
    Added toArray and toString
    fixed invalid usage strings
    Merge branch 'master' of https://github.com/X39/sqf-vm.git
    added  execution on channels starting with sqf
    systemChat and hint no longer output (null) on empty strings
    fixed precedence of all commands
    added `systemChat` and `hint`
    added isEqualType
    Merge branch 'master' of https://github.com/X39/sqf-vm.git
    Merge pull request #9 from Dahlgren/bugfix/malloc
    malloc.h does not exist in standard C, use stdlib.h
    Added `<ARRAY> select <BOOL>`
    fixed `help__ "||"` usage fucks up due to | being splitter here
    fixed if unary and nullar exist for same command, nullar gets picked if nothing is on right hand
    Fixed memory leaks & out-of-memory crashes due to strings too large
    stringification of null string wont crash anymore
    Added examples to compile
    Added compile command
    Moved check into correct command
    Added empty string check to help__
    Altered error message
    Now always checking for all commands to prevent binary commands being interpreted as variable
    Fixed stringification of strings and added empty string check to set- and getVariable
    Added empty string check to help__
    Improved debug informations snippet
    Hashing is no longer case sensitive
    fixed examples of `help__` and added
    removed unused variable
    fixed `help__ <STRING>` formatting
    fixed warnings & fixed invalid method usage
    fixed memory leaks
    Added `with` command
    Added AllVariables
    Added proper support for removing variables
    added `nil` command
    fixed example of `<CODE> count <ARRAY>`
    Further style changes to help__
    fixed examples not getting printed
    fixed warnings
    doomed keyboard ...
    Implemented extra info into `help__ <STRING>` and now outputting usage instead of description in `help__`
    fixed order off `<ARRA> - <ARRAY>`
    fixed create_command error
    Added more description to commands
    Added support for `<ARRAY> - <ARRAY>`; `==` and `!=` now properly error out on missmatching types
    fixed missing righthand on typename segfaults
    forgot to add the check if nothing was found
    Added note when nothing was found to `help__` and added header
    Added `help__` unary variant
    Did stuff
    doMove now supports array syntax
    Added objNull
    Added null check to objects
    POBJECT object_create(const char* classname) is exposed again
    Added ccomment placeholder for WITH type in is_equal_to
    fixed is_equal_to for objects
    Added stringify cases for NOTHING and ANY
    More stringify & isEqualTo type compatibility
    added side to stringify
    Added side commands
    Added SQF stupidity that `,` also can be used to terminate instead of `;`
    fix of merge
    merge
    fixed issues i didnt see thx to visual studio not building properly ...
    Altered productname & upped build number
    Upped version
    Added VEHICLE & UNIT inner-objects to OBJECT
    removed bool.h
    Added SIDE type
    Added garbage fix for gcc on debian trash glibc implementation bullshittery
    added return for non-windows machines
    removed unneded variable, renamed variable
    Merge branch 'master' of https://github.com/X39/sqf-vm
    Added missing blank
    Cleaned up warnings
    fixed crash due to uninitialized variable
    Merge branch 'master' of https://github.com/X39/sqf-vm
    Added FAQ
    fixed private <string>
    Added NAN to log -1 and unary +
    Added doMove

 

Share this post


Link to post
Share on other sites

Released SQF-VM Standalone Alpha 0.1.4 (tool allowing you to run arbitrary sqf code) https://github.com/X39/sqf-vm/releases/tag/0.1.4-alpha
As usual, the hint that the Discord-Server contains a bot that allows you to run the code inside of discord.

 

Highlights of this version:

  • support for `spawn` (executed after the sync context of the VM is done, might suspend a script to give other scripts a chance to run)
  • support for config parsing (during runtime, use `configFile mergeFrom__ parseConfig__ "<YOUR CONFIG>"`)
  • Changes to the command line parameters (making old scripts possibly outdated)

 

Changelog: 

SCRIPT:t:0:(null)
CONFIG:t:0:(null)
configFile:n:4:nil
selectRandom:u:4:selectRandom <ARRAY>
getText:u:4:getText <CONFIG>
tolower:u:4:tolower <STRING>
vectorNormalized:u:4:vectorNormalized <VECTOR3D>
toupper:u:4:toupper <STRING>
isArray:u:4:isArray <CONFIG>
isText:u:4:isText <CONFIG>
vectorMagnitude:u:4:vectorMagnitude <VECTOR3D>
isNumber:u:4:isNumber <CONFIG>
getNumber:u:4:getNumber <CONFIG>
inheritsFrom:u:4:inheritsFrom <CONFIG>
isClass:u:4:isClass <CONFIG>
getArray:u:4:getArray <CONFIG>
reverse:u:4:reverse <ARRAY>
scriptDone:u:4:scriptDone <SCRIPT>
vectorMagnitudeSqr:u:4:vectorMagnitudeSqr <VECTOR3D>
>>:b:4:<CONFIG> >> <STRING>
vectorMultiply:b:4:<VECTOR3D> ectorMultiply <SCALAR>
vectorDistance:b:4:<VECTOR3D> vectorDistance <VECTOR3D>
vectorDistanceSqr:b:4:<VECTOR3D> vectorDistanceSqr <VECTOR3D>
vectorDiff:b:4:<VECTOR3D> vectorDiff <VECTOR3D>
spawn:b:4:<ANY> spawn <CODE>
resize:b:4:<ARRAY> resize <SCALAR>
vectorDotProduct:b:4:<VECTOR3D> vectorDotProduct <VECTOR3D>
vectorAdd:b:4:<VECTOR3D> vectorAdd <VECTOR3D>
vectorCos:b:4:<VECTOR3D> vectorCos <VECTOR3D>
createUnit:b:4:<GROUP> createUnit <ARRAY>
deleteAt:b:4:<ARRAY> deleteAt <SCALAR>
append:b:4:<ARRAY> append <ARRAY>
find:b:4:<ARRAY> find <ANY>#<STRING> find <STRING>
exitWith:b:4:<IF> exitWith <CODE>
/:b:7:<SCALAR> / <SCALAR> | <CONFIG> / <STRING>
arrayIntersect:b:4:<ARRAY> arrayIntersect <ARRAY>
vectorCrossProduct:b:4:<VECTOR3D> vectorCrossProduct <VECTOR3D>

mergefrom__:b:4:<CONFIG> mergefrom__ <CONFIG>
parseconfig__:u:4:parseconfig__ <STRING>

 

Share this post


Link to post
Share on other sites

we just found a tiny bug in the latest release that will cause either endless loops or a crash of the tool when using local variables (eg _var, global ones are not affected) or commands that involve local variables (eg. count)

 

will not release a fix unless one is interested in it (already fixed on master, next version obviously also will have this fixed)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×