Jump to content

GefrManny

Member
  • Content Count

    12
  • Joined

  • Last visited

  • Medals

Posts posted by GefrManny


  1. Hi everyone,

    I'm a little bit confused by the progress bar dialog control. Creating and adding one isn't exactly my problem, but I wonder how to actually use it. I was unable to find a function that lets me set/move the progress bar's current progress. Has anyone worked with this control and wants to share experience?

    -- Manny


  2. Quote[/b] ]Out of interest, if player is null, does that mean that commands like side player do not work correctly with JIP clients?

    You'll always have to be a little bit more cautious with the side command. As pointed out above it seems to be null at the very start, and furthermore it's civilian if the player is currently dead. Just wanted to point that one out in case you're using it in non-init scripts.

    Quote[/b] ]<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while {( isnull player )} do {

    sleep 0.5;

    };

    I'm not quite sure, but player might always be null for dedicated servers. Perhaps you might want to tweak that one a bit. Not that it's a significant performance drain, but suspending unneeded scripts/triggers is always a good idea IMHO ;-)

    Furthermore, you might want to add your knowledge to the Biki. But iirc it's already noted somewhere in the player article.


  3. Oh no, somebody spot my heavily work in progress article on the Biki! We are doomed!

    Err..

    either way. The article - as it is of now - probably won't be too helpful. Nor am I a dialog guru. I just tried to work with dialogs a couple of times using old OFP tutorials and pretty much ran into problems. Then I disassembled missions and pbos to get some insight - or at least as far as I could. Now I just want to write down what I've found out, so others don't have to follow the same path but rather take the shortcut.

    Btw, I would appreciate anyone who actually contributes to the article. I'm two things: a.) busy and if I ain't that, then I'm being b.) lazy (at least every now and then). So any insight - especially experienced insight - is welcome.

    I've already had a brief talk with Col. Sanders (but I think we pretty much hit offtopic turf very fast wink_o.gif) though I am not quite sure if and where I can help. Especially since I have one or two others projects on my own, plus the usual stuff I do at the university, plus my girlfriend, etc. That pretty much reduces my spare time to a minimum that I usually spend on recreation (playing ArmA / Guild Wars) rather then yet again do more work.

    -- Manny


  4. It is indeed very tricky for SQF, I can confirm that by.. errr... let's call it "experience" (parse errors in "correct" code or vice versa has a negative connotation wink_o.gif). But nasty lookaheads >= 2 are pretty much common at certain decision making points within a parser's productions. Especially in SQF (think of a statement (<semicolon> statement )* [<semicolon>] <eof> production - which is valid in SQF); either that, or I suck. It's probably a compromise of both.

    It get's worse though: the only way I could actually let the lexer check for function calls and their arguments without hardcoding all 100+ functions themselves or running into leftsided recursions is by keeping all function related data externalized in a (XML, CSV, TXT, ...) file and make pretty ackward looking checks, mostly at points where the parser identifies an IDENT-token (which is by my definition [a-zA-Z_][a-zA-Z0-9_]*) and checks if there should be any arguments left or right of it.

    I, by the way, do actually try to verify expression types wherever sane and possible as an added fun bonus. However, it really has its limits.

    Also, I have to agree with you in one particular statement: I must admit parsing is completely over my head in most contexts. You do seem fairly competent to me, so don't degrade yourself wink_o.gif I, for one, would welcome a little joint effort.


  5. It's pretty easy. I've done it already. Not in BNF form simply because doing tokenized lexical parsing (via a State Machine)and then using an abstract syntax tree for semantical parsing works far better. It helps if you want semantical parsing on a seperate thread.

    In theory, LL(n) parsers or Deterministic Finite State Machines for that matter *should* do the job. That is, once you have the time to figure out if the grammar is actually correct and exactly the same as ArmA's. Practically, I fear that there are trade-off decisions to think about concerning the implementation, and several points of big, nasty lookaheads.


  6. (Prologue: If you don't know what BNF is about, then you might want to skip this topic since it probably won't matter to you.)

    This question is perhaps a little ackward, but I wonder if Bohemia has documented the SQF/SQS syntax in BNF somewhere, or if someone came up with a legitimate notation.

    Probably it isn't something of interest for scripters but I think it is something important if anyone came up with the idea to write an IDE for ArmA editing.

    Regards,

    Manny


  7. I've located the problem, the root of all evil lies herein:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_allowed = ["StrykerBase", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"]];

    _allowed = +["BRDM2", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"]];

    _allowed = +["Tank", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"]];

    _allowed = +["Air", ["SoldierWPilot", "SoldierGPilot", "SoldierEPilot"]];

    I accidently confused the unary +array operator as union, whereas it actually is just "copy that array". Hence my _allowed only contained the last entry.

    Should be working now with the following script:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">comment " ---- SETUP SECTION ---- make modifications here ---- ";

    comment "ALLOWED CLASSES";

    comment "Which vehicle kind requires which class?";

    comment "Values: [ vehicle class name, [ allowed unit class 1, allowed unit class 2, etc. ] ]";

    comment "Check http://community.bistudio.com/wiki/ArmA:_CfgVehicles for class hierarchy!";

    _allowed = [

    "StrykerBase", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"],

    "BRDM2", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"],

    "Tank", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"],

    "Air", ["SoldierWPilot", "SoldierGPilot", "SoldierEPilot"]

    ];

    comment "FREE POSITIONS";

    comment "No class check for these positions (possible: driver, gunner or cargo):";

    _free = ["cargo"];

    comment " ---- END OFSETUP SECTION ---- keep out unless you have a reason to meddle with it ---- ";

    _veh = _this select 0;

    _pos = _this select 1;

    _unit = _this select 2;

    _t_unit = typeOf _unit;

    _t_veh = typeOf _veh;

    _entries = count _allowed;

    _do_eject = 0;

    if (!(_pos in _free)) then

    {

    for [{_vi = 0}, {((_vi < _entries) and (_do_eject == 0))}, {_vi = _vi + 2}] do

    {

    _veh_kind = _allowed select _vi;

    if (_veh isKindOf _veh_kind) then

    {

    _unit_kind = _allowed select (_vi + 1);

    _do_eject = 1;

    _unit_kinds = count _unit_kind;

    for [{_ui = 0}, {((_ui < _unit_kinds) and (_do_eject == 1))}, {_ui = _ui + 1}] do

    {

    _allowed = _unit isKindOf (_unit_kind select _ui);

    if (_allowed) then { _do_eject = 2; };

    };

    };

    };

    };

    if (_do_eject == 1) then { _unit action ["EJECT", _veh]; };

    Case solved, thanks to everyone. smile_o.gif

    Sincerely,

    Manny


  8. Interesting. Didn't know that SQF-files actually required execVM or spawn. Most of my (simple) scripts seemed to work with exec.

    execVM tells me no error, but doesn't really seem to work either (_do_eject always is -1 if I add hint format ["Eject: %1, _do_eject] after all the code).

    exec however leaves me with a simple '|#|};' Error missing { and nothing further being specified.

    Btw, I my editor features syntax highlighting, the { } count seems to be equal.

    Edit:

    Quote[/b] ]You need to get some sort of programmer's editor (I'm using UltraEdit, but there are lots others to choose from out there).

    Exactly that one.


  9. Hey all.

    I've recently tried to come up with a more universal SQF script that checks if a player has a specified class and is therefor allowed (or not) to enter a vehicle. However either the parser has difficulties with blocks within blocks, or I messed up the syntax pretty good. Either way, I'm out of ideas.

    The whole script is called from the vehicle's getin-eventhandler, this addEventHandler ["getin", { _this exec "thescriptbelow.sqf" }]. Replacing exec with execVM only leads to error output supression, but that's about it :-/

    The script:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">comment " ---- SETUP SECTION ---- make modifications here ---- ";

    comment "ALLOWED CLASSES";

    comment "Which vehicle kind requires which class?";

    comment "Values: [ vehicle class name, [ allowed unit class 1, allowed unit class 2, etc. ] ]";

    comment "Check http://community.bistudio.com/wiki/ArmA:_CfgVehicles for class hierarchy!";

    _allowed = ["StrykerBase", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"]];

    _allowed = +["BRDM2", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"]];

    _allowed = +["Tank", ["SoldierECrew", "SoldierWCrew", "SoldierGCrew"]];

    _allowed = +["Air", ["SoldierWPilot", "SoldierGPilot", "SoldierEPilot"]];

    comment "FREE POSITIONS";

    comment "No class check for these positions (possible: driver, gunner or cargo):";

    _free = ["cargo", "gunner"];

    comment " ---- END OFSETUP SECTION ---- keep out unless you have a reason to meddle with it ---- ";

    _veh = _this select 0;

    _pos = _this select 1;

    _unit = _this select 2;

    _t_unit = typeOf _unit;

    _t_veh = typeOf _veh;

    hint format ["%1 is a %2 and gets in %3 position of %4", name _unit, _t_unit, _pos, _t_veh];

    _do_eject = -1;

    if (!(_pos in _free)) then

    {

    for [{_vi = 0}, {((_vi < (count _allowed)) and (_do_eject == -1))}, {_vi = (_vi + 2)}] do

    {

    _veh_kind = _allowed select _vi;

    if (_veh isKindOf _veh_kind) then

    {

    hint format ["%1 is a kind of %2", typeOf _veh, _veh_kind];

    _unit_kind = _allowed select (_vi + 1);

    _do_eject = 1;

    for [{_ui = 0}, {((_ui < (count _unit_kind)) and (_do_eject == 1))}, {_ui = (_ui + 1)}] do

    {

    _allowed = (_unit isKindOf (_unit_kind select _ui));

    if (_allowed) then { _do_eject = 0; };

    };

    };

    };

    };

    if (_do_eject == 1) then { _unit action ["EJECT", _veh]; };

    Thanks in advance,

    Manny

×