Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Fwatch General Scripting

  1. #11

    Stance check script BETA

    @DanAK47

    Quote Originally Posted by DanAK47 View Post
    There was (and still is?) no way to detect if the player was standing, kneeling, or lying down consistently.
    Not anymore...

    I am proud to present you Stance Check script:
    Spoiler:

    http://www.gamefront.com/files/21612...e_missions_zip
    All credit goes to Faguss. He did 95% of all work. I just did some editing and testing.

    It is capable of detecting all three stances (standing, crouch and prone).
    Works with both original Arma:CWA (v1.99) and original OFP (v1.96) Config (ww4 mod version will be released in future)
    Requires Fwatch v1.1. You can download installer (easy way) at webiste of Faguss: http://ofp-faguss.com/files/fwatch_install.exe

    Or if you are familiar with Fwatch, then follow this link Spoiler:


    Take care, Icarus
    Last edited by Icarus; Jun 15 2012 at 18:22. Reason: Updated Fwatch v1.1 compatibility (now Arma: CWA capable)

  2. #12

    Lightbulb Stance check script for ww4 mod v2.5

    Following my promise to release Stance Check script for ww4 mod v2.5:
    Spoiler:


    http://www.gamefront.com/files/21612...5_examples_zip

    All credit goes to Faguss. He did 95% of all work. I just did some editing and testing.

    It is capable of detecting all three stances (standing, crouch and prone).
    Works with ww4 mod v2.5 for both Arma:CWA (v1.99) and OFP (v1.96)
    Requires Fwatch v1.1. You can download installer (easy way) at webiste of Faguss: http://ofp-faguss.com/files/fwatch_install.exe

    Or if you are familiar with Fwatch, then follow this link Spoiler:


    Take care, Icarus
    Last edited by Icarus; Jun 15 2012 at 18:22. Reason: Updated Fwatch v1.1 compatibility (now Arma: CWA capable)

  3. #13
    hi,

    Very nice work Icarus and Faguss, keep it up!

    cya.

    Nikiller.
    [LOL] ofp/ArmA clan since 2004.
    No Respawns, No Crosshairs, No Muppets.
    Want a good ofp/ArmA2 coop? Visit the [LOL] clan homepage | ofp [LOL] addons pack | ArmA2 [LOL] addons pack

    WW4mod25 sound replacement mod v1.1 | Nikiller's scripts pack

  4. #14
    I changed download links if anyone is wondering...

    Icarus

  5. #15
    Quote Originally Posted by Icarus View Post
    So is the mem getplayeranim command only for player use?

    Can it be used for bots too?
    Negative and there won't be such method. I don't know how to find other units in the memory. Player is constant so his values are easily accessible.

    -----------------------


    Creating a hotkey is the the most common usage of Fwatch. Here are simple examples:

    Code:
    _pressed = ""
    
    #Loop
    ~0.02
    _keys = call loadfile ":input getkeys side"
    _key = _keys select 0
    
    ? count _keys==0 : _pressed=""; goto "Loop"
    ? _key == _pressed : goto "Loop"
    _pressed = _key
    
    ? _key == "K" : player globalchat "You've pressed K"
    goto "Loop"
    Only one pressed key is recognised. Variable _pressed prevents continous action so you won't execute code 300 times a second. Blue is the customizable part.

    Code:
    _pressed = ""
    
    #Loop
    ~0.02
    _keys = call loadfile ":input getkeys side"
    ? _pressed in _keys : goto "Loop"
    _pressed = "null"
    
    ? "K" in _keys : player globalchat "You've pressed K"; _pressed="K"
    goto "Loop"
    This variation will recognise multiple strokes but you'll have to assign _pressed manually.

    Code can be improved to eliminate weaknesses but I wanted to show only basic stuff.
    Last edited by Faguss; Apr 25 2012 at 15:02.
    -------------

  6. #16
    I tried to use this animation viewer, but with no luck. When I try to run it "ERROR READING FILE" and this is my firt time trying to run FWATCH, cheers

  7. #17
    Animation list is read from external file so make sure the directory "AnimationViewer" with all the files is in mission folder.

    Script will only work from Mission Editor so copy mission to the "Users\...\missions" or "Users\...\MPmissions".

    If it still doesn't work then check AV / FW whether they block Fwatch.

    -----

    EDIT: I forgot that there are problems in Fwatch 1.1 with reading current user from the registry. This was fixed in version 1.11 (still in the works).
    Last edited by Faguss; Oct 23 2012 at 00:15.

  8. #18

  9. #19
    Passing dialog position

    Commands :mem getcursor and :input getkeys make it possible to create your own dialog controls. However, scripts require elements coordinates. Typing it by hand is a chore so let's automate it.

    We are going to use Fwatch to save numbers from the dialog and then have a script read it.

    __EXEC doesn't support brackets so __EVAL it is. The returned value must be assigned to something. Put it into any property:

    Code:
    a = __EVAL()
    You can wrap it up in a class:

    Code:
    class fwatch_save
    {
    	a = __EVAL()
    };
    Just in case I'm removing the file every time on the beginning:

    Code:
    a = __EVAL(loadFile format [":file delete %1", "filename"])
    and then using qwrite to save coordinates:

    Code:
    b = __EVAL(loadFile Format[":file qwrite %1 %2 %3", "filename", "varnme", [X,Y,W,H]])
    Here's a full example:

    Code:
    __EXEC(FCM_Background_X=0; FCM_Background_Y=0; FCM_TotalWidth=1; FCM_TotalHeight=1)
    
    class FCM_Background : fcmTXT
    {
    	x = __EVAL(FCM_Background_X)
    	y = __EVAL(FCM_Background_Y)
    	w = __EVAL(FCM_Background_W)
    	h = __EVAL(FCM_Background_H)
    };
    
    fcm_save2 = __EVAL(loadFile Format[":file qwrite fcm_dialog.db back %1",[FCM_Background_X,  FCM_Background_Y,  FCM_TotalWidth,  FCM_TotalHeight]])
    With many calls to fwatch there is a noticeable pause when you load the mission so don't go wild.

    Now reading the data from a script:
    Code:
    	_data = call loadFile ":file read fcm_dialog.db back"
    	? format ["%1",_data] == "-1" : hint "FCM ERROR:\nCannot read fcm_dialog.db back"; exit
    	FCM_BGX = (_data select 0) * 100
    Because coordinates are from 0 to 1 and :mem getcursor returns values from 0 to 100, data on one of the side needs to be converted. Here I'm multiplying dialog numbers by 100. This is something I haven't paid attention during Fwatch development and in version 1.12 there is going to be an option for :mem getcursor to return position in a compatible format.

    Other application of this method could be to transfer data from addon configs or main configuration to scripts. Like vehicle capacity for example.





    Generating scripts

    Using Fwatch IGSE commands to create a text file and write something to it. First set up variables:

    Code:
    _filename = "Bla.sqs"
    _lineNUM = 1
    Then create a file (mode w means erasing existing content)
    Code:
    _opened = call loadFile Format [{:in "%1" w}, _filename]
    ? !_opened : exit
    Writing a single line requires four lines of code:
    • Point to the file and line number
    • Write data
    • Create a new line
    • Increment line number variable


    For example:

    Code:
    	loadFile Format [{:ip "%1" %2}, _filename, _lineNum]
    	loadFile Format [":i %1", "first line"]
    	loadFile Format [":i %1", "=newline="]
    	_lineNUM = _lineNUM + 1
    		
    	loadFile Format [{:ip "%1" %2}, _filename, _lineNum]
    	loadFile Format [":i %1", "second line"]
    	loadFile Format [":i %1", "=newline="]
    	_lineNUM = _lineNUM + 1
    If you create a new file - you must write something in the first line (even if it's empty string).
    Last edited by Faguss; Mar 6 2013 at 18:30.

Page 2 of 2 FirstFirst 12

Posting Permissions

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