Jump to content
Sign in to follow this  
DBR_ONIX

Trigger external program from within OFP..?http://

Recommended Posts

I swear... it's like we never existed sometimes..... mad_o.gif

Nah, no-one forgot about you! We really appreciate what you did concerning saving in MP!

It's just that even you couldn't solve the problem of saving strings or arrays in a somehow reasonable way, you only could save integers, floats of limited size, booleans and binary combinations AFAIK. With the save-to-file command everything will get piss-easy now. You want to save a string? Just write it into the file.

You know what I mean? wink_o.gif

Share this post


Link to post
Share on other sites
I swear... it's like we never existed sometimes..... mad_o.gif

Nah, no-one forgot about you! We really appreciate what you did concerning saving in MP!

It's just that even you couldn't solve the problem of saving strings or arrays in a somehow reasonable way, you only could save integers, floats of limited size, booleans and binary combinations AFAIK. With the save-to-file command everything will get piss-easy now. You want to save a string? Just write it into the file.

You know what I mean? wink_o.gif

Yeah.. you are correct.. thanks for the bit of confidence... I get very few requests or comments on SOW that sometimes it seems like no one notices.. but thank you again.

Arrays and strings are currently unsupported and yes, it will be piss easy for us now... however, we probably won't incorporate this concept for awhile (time consuming reasons) but it has peaked my interest for the exact reasons you mention. I could actually include a REAL database for SOW if I wanted to now!

@Keg

Good work on the latest features.

I am also very glad for your inclusion of the key presses.. I was about to suggest something along that lines. It'll take debugging consoles in OFP to a whole new level!

Share this post


Link to post
Share on other sites
Yeah.. you are correct.. thanks for the bit of confidence... I get very few requests or comments on SOW that sometimes it seems like no one notices.. but thank you again.

I guess the problem is that very few people actually use complicated but strong techniques, it's the same with CoC UA, CoC NS and CoC CE. People are afraid not to understand and thus don't even start to get into it. But that's not your fault.

Again concerning MP saving, even missions with JIP were possible then. You just save the whole thing, restart with the joined people and load the save. Thus savegames had to be stored on the server.

Another question that came to my mind, would there be any way to intercept if a sideChat console is currently opened when using the getkey function? I couldn't think of any right now, but maybe you've got ideas. It's important, since interpreting keys that are used while writing text would be fatal for a scripter.

What about querying joystick buttons? Would that be possible too for you in a reasonable way?

Share this post


Link to post
Share on other sites

@Kegetys:

would it be possible make this thing check which keys are bound to which action in the keybinds?

So you could then check whether a prone or other stance buttons have been pressed....

Would finally make that getUnitStance function possible...

Share this post


Link to post
Share on other sites
@Kegetys:

would it be possible make this thing check which keys are bound to which action in the keybinds?

So you could then check whether a prone or other stance buttons have been pressed....

Would finally make that getUnitStance function possible...

Where are the keybindings saved, I guess in the player's userconfig? It would be possible to read the keybindings from that file, but it wouldn't help to create a getUnitStance-function, because...

You check for the Go Prone, or for the Crouch-Key... the player goes prone, then he switches to his secondary weapon, et voila, your information about the player's stance is now wrong.

Another one is the Heal-Action. You are in crouch position after being healed (you were before prone).

So forget about the getUnitStance-function sad_o.gif

I implemented key-check and mouse-position functions into my version, too. But the mouse-position functions aren't really useful, as they don't show you the position of OFP-cursor (in a dialog or the map), but the Windows-cursor, which is different. So the only thing that would be useful IMHO is a mouse move function that returns the movement of the mouse (since the last check).

Share this post


Link to post
Share on other sites

Damn, you're right... sad_o.gif

Well, it's back to other kinds of workaround theories then...

Share this post


Link to post
Share on other sites

For intercepting the chat message, when the chat button is pressed (Check the key binding list), everything up till an enter is a typed message.

One problem with things like this, what if you end the mission, say in mission editor, is there a way to check a mission is running?

The mouse movent in games is different to normal, it's allways centered, when you move it a CM out, the game makes your character turn x*, then shoves the mouse back to the center. I suppose you could monitor the ammount the mouse has moved, what direction etc. Only thing, what use does this have? rock.gif

Few things about the DLL, how user-friendly will the final version be? I.e Start the game, alt-tab, find the EXE, run it, go back in game, and do this etc etc.. Or run the installer, and use the shortcut on the desktop.

Also, if the person doesn't have the DLL hook running, and the mission needs this, how will the game cope? I know this is mainly for Dedicated servers, but the huge ammount of uses will deffinatly be used in single-player

Hmm, the SoW system, is there any (Public) missions using this? I've not had much time to look around the forums, as I've been trying (and still am) to fix my main computer..

- Ben

Share this post


Link to post
Share on other sites
Hmm, the SoW system, is there any (Public) missions using this? I've not had much time to look around the forums, as I've been trying (and still am) to fix my main computer..

- Ben

Yes. For the most part there is a demo complete w/ documentation. There is also available some notes regarding how to use the object.sav file to save data. With this new DLL or a similar idea I have in mind, I plan on implementing a way for an external prog to retrieve data from the object.sav file and store it in another format (XML probably). I will then turn the object.sav file into more-or-less a buffer/interface between the XML and the OFP engine. Right now, you are limited to manually backing up the object.sav file if you want to endure a different campaign or backup your mission progress. With this idea, you could implement a way to select different loadings from within OFP (hopefully prior to starting a mission). At least, that is a rough outline of what I want... not necessarily what I am working on right now. ;)

SOW Downloads:

http://www.sinewsofwar.com/forum/dloads.php

*There is an issue with many players in MP concerning the menu. There is a fix available that will be released shortly in combo with some other data compression improvements. In interim it is available via PM on the SOW forums if you run into this bug while playing. Basically the menu ceases to function when there is a significant amount of players due to over-zealous use of functions and it's hinderance with CoC_NS*

Share this post


Link to post
Share on other sites
Few things about the DLL, how user-friendly will the final version be? I.e Start the game, alt-tab, find the EXE, run it, go back in game, and do this etc etc.. Or run the installer, and use the shortcut on the desktop.

Right now it can be used in two ways, either by running fwatch.exe instead of the ofp exe normally, which will launch flashpointresistance.exe, or by running fwatch.exe -nolaunch which will work the same way as that example version which displays a dialog and then you run OFP manually.

Quote[/b] ]So the only thing that would be useful IMHO is a mouse move function that returns the movement of the mouse (since the last check).

Relative mouse motion can be retrieved by using setmouse and getmouse together in the script, set the mouse cursor to some location, wait a short delay and see how much the cursor has moved and then set the cursor back again. I wrote a simple script that is like the camera.sqs except you move the camera by mouse and it seems to work well. For keyboard input the best way to avoid problems like the chat dialog thing is propably to call disableuserinput to stop all the game's keys from working while the script is running, this of course means though that you cant chat in MP while using your script.

I also got the pipes working so its quite fast now, I did a script that calls getmouse 10 000 times and it was done in about 2 seconds.

One limiting issue I found is that there's a bug in OFP that crashes the game if you call exec/loadfile with a filename longer than 132 characters. Without that it would propably have been possible to do some sort of multiplayer saving etc. by saving arrays of info about each unit, but that array is always so long that it would need to be split into dozens of different values which would propably be quite difficult to do.

Share this post


Link to post
Share on other sites
but that array is always so long that it would need to be split into dozens of different values which would propably be quite difficult to do.

CoC's array splitting functions come to mind. With them it may be possible, where an array is split up in variables, each storing an element of the array.

They can be found in the CoC NS.

Share this post


Link to post
Share on other sites

@ Crashdome

If you actually read what you've quoted you'll see I said MP saves that record player positions, weapons, ammo etc. Which as you say yourself, SOW unable to do. I'm sure you've spent a great deal of time and effort on your mod and would like some appreciation for it, but we're not talking about your mod. Repeatedly trying to bring this thread around to the subject of SOW and berating people for asking question that are directly related to what is possible with the tools discussed in this thread is at best unhelpful and at worst unfriendly.

Apologies to mods if this post offends. I'd like to get back on to the topic asap, I'm not trying to start any fires here.

Share this post


Link to post
Share on other sites

My apologies. My intentions were not to berate anyone. It was a moment of weakness for me, yes I shouldn't have yelled.

However, I am concerned very much about this thread which is a discussion about using an external program which is triggered by OFP. Kegetys and Vektorboson have progressed very far and I've been working with both their concept AND the notion of using the object.sav file as a means to overcome some data sending issues (vs. using scripts). As I explained above, I feel SOW is relevant because it's an application of this idea and because people have expressed MP saving as an extension of this concept. I'm not hijacking this thread, I'm merely trying to discuss these topics and how I've progressed thus far (from the other end). Everything you've mentioned except "player positions" is capable via SOW at this point. Saving player posiitons is possible also, but as I expressed "not efficient enough". My hope is to break that barrier utilizing some of these new tools.

I was under the assumption also that this thread wasn't called "Kegetys and Vektorbosons file access and keyboard hook DLL" and I had some freedom to discuss alternate file access.

Some new findings by me:

@Vektorboson & Kegetys

I ran some tests regarding that FileSystemWatcher class and you are right on two parts. File Access via that class is completely unreliable even for the object.sav file. It appears that the only way IS to hook win32api calls. I'm kinda bummed because I also think api code is ugly. Also, I haven't tested it yet, but anti-virus scanners should not trigger this DLL since you explicitly define the OFP process. BUT I'm gonna run a test anyway to verify. Is the latest code by yourselves available? or are you touching some things up?

Share this post


Link to post
Share on other sites

@Yssabem

What do U deliver for this threat ?

Share this post


Link to post
Share on other sites
vektorboson;
Quote[/b] ]Allrighty,

here is my version of Kegetys TestDLL (I didn't change the filenames...)

Please read the README.txt.

Functions reference:

"\:version:"

Is this the 'Windows Clock' solution?

Yes, it's the "\:time" command. Just look into the README, how to use it!

Quality. Nice one. Should add some reallity and real world atmosphere. Havn't had a chance to play with it yet, but looking forward to it. smile_o.gif

How do you people figure these things out? I don't even have the first clue about were to start.

Share this post


Link to post
Share on other sites

"Repeatedly trying to bring this thread around to the subject of SOW and berating people for asking question that are directly related to what is possible with the tools discussed in this thread is at best unhelpful and at worst unfriendly."

Erm, no comment towards Keyetys or Vektor' changing it from monitoring a file to DLL Hook rock.gif

Has anyone acctualy looked at the first post?!

..sorry sad_o.gif

Anyway, using the saveStatus command, and object.sav is a good way of passing data out (and in, acctualy smile_o.gif) to OFP. The two things together are, powerfull smile_o.gif

I.e save data to object.sav, and then prod the program with loadFile ":writenToObject.sav - Here", then read that and do what is nessisary with it..

Anyway, I've got my PC fixed, now I can finaly test the Hook DLL biggrin_o.gif

- Ben

Share this post


Link to post
Share on other sites

@Vektorboson & Kegetys

Is the latest code by yourselves available? or are you touching some things up?

You can get my latest version

http://home.arcor.de/vektorboson/res/testdll.zip

It has basically the same functionality as Kegetys, though some are different or missing.

As I don't know how to get the Pipe working, I'll wait for Kegetys' version and incorporate his stuff into my version.

Even if you'll use later Kegetys version, you can try some stuff now.

Share this post


Link to post
Share on other sites

I have some stuff to do over the next few days, but I can't wait to try it out the end of this week!

Share this post


Link to post
Share on other sites

I can't get this to work sad_o.gif

Extracted the stuff to a folder on desktop, ran TestLauncher.exe

Started game, put the hint format :version stuff in, preview, and it says Error loading file :version. I alt tab, and click okay, then preview the mission, OFP CTD

I started OFP, made the unit/INIT field, alt tab and start the hook, same thing, and same thing when I press okay on hook and start the mission without it..

Running 1.96, not beta, not many addons (2 or 3 islands, and one or two random addons), with nomap.

PC spec is medium-ish, 2.8GHz, 512mb ram, 128mb graphics, windows XP. But I don't think that's the problem..?

- Ben

Share this post


Link to post
Share on other sites
I can't get this to work sad_o.gif

Extracted the stuff to a folder on desktop, ran TestLauncher.exe

Started game, put the hint format :version stuff in, preview, and it says Error loading file :version. I alt tab, and click okay, then preview the mission, OFP CTD

I started OFP, made the unit/INIT field, alt tab and start the hook, same thing, and same thing when I press okay on hook and start the mission without it..

Running 1.96, not beta, not many addons (2 or 3 islands, and one or two random addons), with nomap.

PC spec is medium-ish, 2.8GHz, 512mb ram, 128mb graphics, windows XP. But I don't think that's the problem..?

- Ben

What is the exact command, you type in?

You should use

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

hint loadfile "\:version"

The trailing backslash has to be there, otherwise it won't work!

Share this post


Link to post
Share on other sites

Yup, copied/pasted that, "File ':version' read error"

Aha, found the problem, if you run the game with -nomap, it will not work

Now to go play about with this biggrin_o.gif

Excelent work smile_o.gif

- Ben

Share this post


Link to post
Share on other sites

Wrote half a quick/semi messy save script smile_o.gif

saveData.sqs ::

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_data=FORMAT ["%1",_this select 0]

_file=FORMAT ["\|Ben_Save.sav:%1",_data]

loadfile _file

Radio Trigger Activation

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{[FORMAT ["%1|%2|%3*",name _x,getPos _x,getDammage _x]] exec "saveData.sqs"} forEach thislist

Basic outline, maybe..

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{[FORMAT ["%1 setpos %2;%1 setDammage %3*",name _x,getPos _x,getDammage _x]] exec "saveData.sqs"} forEach thislist

The first way would need something to go though and rearange this, neither way is very well tested, but I'll work on it more later

- Ben

Share this post


Link to post
Share on other sites

Here is a test version of latest Fwatch, it seems to be working quite well but there might still be some bugs I have missed. Source code for it is available here. Remember to read the readme files.

Also Here is a little test mission for it, its a racing mission with keyboard controls, replay feature and records saving. You can also run this script to test that all the fwatch functions are working properly.

Share this post


Link to post
Share on other sites

Very nice gesture, Kegetys! Gonna test it and bug-report (hopefully not) right now!

Edit: Dammit this is actually very cool! I like the race mission, too!

Some notes I made about fwatch:

1) Your OFP Launcher doesn't close when used with fwatch (only after shutting down OFP), can this be 'fixed' (changed actually, since it's no real bug) ?

2) Why is fwatch.exe demanding internet connection to koti.mbnet.fi ? wink_o.gif I denied it this time, since it would be nice to know _why_ it is demanding.

3) I think a standard about the saved files should be set up right now, before people start to use it. That is, saving files _always_ with the OFPEC TAG in front (as you indicated in your htm file, but I think it didn't get over clearly)

4) Is it possible to include joystick querying functionality?

Well ... that's all!

Now the cool stuff: I love the idea of your race mission, reminds me of good ol' racing games biggrin_o.gif

Also the review worked excellently!

Some pics:

kegrace1.jpg

kegrace2.jpg

kegrace3.jpg

kegrace4.jpg

kegrace5.jpg

kegrace6.jpg

nice! smile_o.gif

Share this post


Link to post
Share on other sites

It'll be requesting to connect to the site so the firewall message comes up when it's launched, not during a mission when the read script for internet command is used smile_o.gif

Going to test now smile_o.gif

- Ben

Share this post


Link to post
Share on other sites
Some notes I made about fwatch:

1) Your OFP Launcher doesn't close when used with fwatch...

2) Why is fwatch.exe demanding internet connection to koti.mbnet.fi..

3) I think a standard about the saved files should be set up right now...

4) Is it possible to include joystick querying functionality?

1. will be fixed in the next version, it was caused by the fwatch launcher not having a win32 message queue.

2. Allow it and you'll see :P It should be wget.exe requesting it though.

3. Maybe, but I'm not into organizing such things so someone else should do it :P

4. I think limited support using win32 api funcions would be possible quite easily, it would only support the primary joystick though and not that many buttons... "Proper" joystick support would require DirectInput things and that would mean writing alot of messy code which I would not want to do. Scripts using those possible joystick input functions would then also need some easy way to toggle between different input methods for those people who do not use a joystick with OFP (me included).

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
Sign in to follow this  

×