About.. a month ago? Maybe more, I had the same idea, to edit scripts via external program. Basicly what I did was use Visual BASIC to write two small programs, using WinSock.
When a message was sent from the client, it sent the data to the server program, which then created a script in the root of the flashpoint folder called ExternalChat.sqs or something.
?(1<= MessageRead):exit
player globalchat "#25/07/2005 20:17:59 : testing"
MessageRead=1
EXIT
Then the next ::
?(2<= MessageRead):exit
player globalchat "#25/07/2005 20:18:31 : testing again"
MessageRead=2
EXIT
etc
This was sort of usefull, the program (Same idea without a client, the "server" program gets info and creates the file) could get information from lots of places (Server computer, website database etc) and display this in game. The biggest problem was stoping it (OFP) showing the same message repeatedly, as there was no way of getting OFP to delete the file, thus the annoying ?(2<= MessageRead):exit stuff
(Program not released, as it's kinda fiddley to set up and of very limited use, but it's availbe if needed, email me if you want it
With FWATCH, you could create a file in FWATCH/mdb with the message, read this and display it in game, then delete the file with the delete command, so it's not read again, very easy/neat, I'll write this sometime
)
This came from the idea that if I could take a screenshot, save it to the OFP folder and setobjecttexture it to something, so you could have real ingame intelligence,
but triggering the screenshot was impossible it seemed..
But... you can run a script from the OFP root, and a friend made a typo : [this] exec "script.exe" (was supposed to be script.sqs)
Hmm, could OFP trigger a program? Nope, got a weird error message (ASCII characters, with a |# unknowned character or something - OFP handles and script run as a text file).
So OFP can load a file from the OFP root, can a program watch this file and see if it's read.. Nope
Buut, I posted the idea on the BI forums (
This thread, and after a few pages, kegetys suggested the idea that led of to FWATCH, which allowed OFP to create a file from a script, then in a program, check this exists, if so take a screenie, save it to OFP root, setobjecttexture it (thing setobjecttexture FORMAT ["../../%1.jpg",{fwatch code to read number from file}] -
The file was created by the VB program.. So if the file saved was 2.jpg, the number in that file was 2, i.e CurrentPhoto=2).
The setobjecttexture bit never really worked very well, it needed the mission to be reloaded, I never tried taking the screenshot in the intro video, but this could work, then you could pass the enemy position via an FWATCH file, so the random positions are the same in the main mission.
(Program can be downloaded
here)
Changing the script works, I've not really tried with loops, but I'm almost certain OFP reads the script, and runs it, after it's finished, it'll forget the script. If it's run again, it'll read the file again, and run it.
A few interesting ideas I came up with while going though the above stuff (Quoted from OFPCamera readme)..
* Use a webcam, and similar idea to current program, to take picture of it, save it into root of OFP folder. Then setobjecttexture (Or possible using dialouges) somewhere. Pointless, but if the OFP server had a server program running, which recivied this image from each player, and sent it to others, it could have it's uses I suppose.
* Sending stats to database via internet. Use FWATCH to create and write stats to a file, in the form
player=dbr_onix
rating=100
misison=MyMission1
Then to use a program to read of these stats, change the format to
http://blah.com/handleStat.php?player=Ben&rating=100&mission=MyMission1
And go to this URL. Then using PHP, enter these values into a database (Could be done in any server-side language, like Perl etc). You could then use this database to create stats for players etc. Or using dialouge ("Enter your squad name"-type thing), squad rankings on CTI servers, for example.
* Use a program to write values to a file, then use FWATCH to read these values into OFP. Or (an idea that I made a while ago, VB->OFP) directly write a script, using varibles from inside the program. I wrote a VB program that recived a message using WinSock, which displayed the message in GlobalChat. A similar idea could be used to get these stats sent to the database back, and display them ingame (A ranking number beside player info on a dialouge, for example)
* Use a similar idea, dynamicly create an image, download it to each client and use setobjecttexture, cutrsc, or similar.
Anyway, I think this is long enough...
Hope this gives some people a few ideas, the program to send stats to a database, if secured by a password entered via a dialouge by an admin (so theres a final arugment on the URL, &password=whateveritis, and the script checks this on the server), so cheating potential is limited a lot, it could be cool. You could have a mission that reloads every 30mins, but people keep their weapons/ammo, health and position, and save the enemys position/health/ammo (unless their dead, a sort of body-delete script), same with vehicles, maybe create new vehicles for desroyed ones at a "repair center". This is possible via Sinews of War's concept, or FWATCH (I.e create a file for each player, a file for enemy units, enemy vehicles etc.
So ben.db :
health 0.4
wepons=m16
magazines=m16
mCount=2
pos=[2322,4342,4]
Then load the file FORMAT ["%1.db",name player])
Good luck to anyone who tries anything relating to this, it can (And probobaly will) open biig doors, and lead to big missions (Big missions can fit though small doors
)
- Ben
Edit : WinSock, not FSock