Home   Help Search Login Register  

Author Topic: [Question]Making a bind key to a known script  (Read 4291 times)

0 Members and 1 Guest are viewing this topic.

Offline MadBafla

  • Members
  • *
[Question]Making a bind key to a known script
« on: 04 Jun 2010, 16:53:43 »
Hi
What I'm asking is if there's an option in OFP to bind a key to make a script (such as saying "reloading" while I am reloading etc.)

If there is one, which I missed in the tutorials, I'd like to get a link to an example of it

Thanks in advance
MadBafla

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Re: [Question]Making a bind key to a known script
« Reply #1 on: 04 Jun 2010, 18:06:27 »
Yes, yes there is a way.

If you can find fWatch, that allows you to monitor keypresses. If you install fWatch, then make the following script:

Code: [Select]
#LOOP
_x = 0
~1
_x = call loadfile ":input getkey X"
? _x = 1 : [parameters] exec "thescript.sqs"
goto "LOOP"

Run the script for the player.

When the player presses the 'X' key, it will execute the script. Change X to whatever you want.

Tell me if that works!
Snarling creature, lurking in the background, still writing in .sqs

Offline MadBafla

  • Members
  • *
Re: [Question]Making a bind key to a known script
« Reply #2 on: 05 Jun 2010, 02:07:58 »
First of all I would like to apologize if I'm wrong because I'm pretty noob on all of the coding stuff :P

Now, if I understand you correctly, the loop you gave me was for editing a script in a mission and such.
What I want, is like a "keybind" that executes that same sqs file (or any other for instance) that will operate it for my user on any multiplayer server.

The point is like to use F1-F12 to known automatic messages that will show up on radio such as need ammo or for example that when I'll press "R" my squadron will get a "Reloading.." message etc.

Is that possible?
Once again, if I misunderstood, if you could be more specific where I put the files and how to use it I'd like that (The radio messages are scripted already from noob understanding technique so need to help with that :-[ )

Thanks again
MadBafla

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: [Question]Making a bind key to a known script
« Reply #3 on: 05 Jun 2010, 05:07:01 »
I'm afraid I've never used fWatch, but

Now, if I understand you correctly, the loop you gave me was for editing a script in a mission and such.

What I want, is like a "keybind" that executes that same sqs file (or any other for instance) that will operate it for my user on any multiplayer server.

You mean you want special features added to OFP for use in multiplayer missions not designed by you? I don't wish to patronize you, but I must point out that that might be considered cheating, depending on context. :confused:

Quote
The point is like to use F1-F12 to known automatic messages that will show up on radio such as need ammo or for example that when I'll press "R" my squadron will get a "Reloading.." message etc.

Well, I'll just assume that you want to do this in a co-op mission, or in a PvP where everyone has this advantage. ;)

So you definitely need this to happen without building or modifying the mission yourself? If so, I'm afraid I can't help you due to my lack of knowledge regarding fWatch. Others may know, though.

But if you build the mission yourself, then I think I know a way to get what you're looking for.
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline MadBafla

  • Members
  • *
Re: [Question]Making a bind key to a known script
« Reply #4 on: 05 Jun 2010, 16:18:53 »
You mean you want special features added to OFP for use in multiplayer missions not designed by you? I don't wish to patronize you, but I must point out that that might be considered cheating, depending on context. :confused:
Well you're not the 1st I've heard calling what I want to do a cheat, though I have to say that I do not understand why.

I have seen a lot of games that has this function and I encountered enough players with functions very similar to what I'm asking for WITHOUT being called or accused as cheaters.
In my opinion btw, This function could amplify the game experience by much, especially in co-op missions.

But to the point:
Yes.. I am asking for a way to do that without tampering with the missions myself (that will be cheating, wont it?) and I am not thinking about making my own mission because my knowledge in scripting etc. is very low.

I have downloaded fWatch but had trouble installing it cause it hasn't got an .exe file in it (I think I downloaded source idk where to get install file and how to operate it)
If others do know how to operate this program I'd be glad to learn.. I've searched for the tutorial's section and found no recollection of this program

Hope someone can help me
MadBafla :good:

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: [Question]Making a bind key to a known script
« Reply #5 on: 05 Jun 2010, 17:34:23 »
Quote
I have seen a lot of games that has this function and I encountered enough players with functions very similar to what I'm asking for WITHOUT  being called or accused as cheaters.

Well, like I said, it all depends on context. Just use discretion.  :P

Quote
Yes.. I am asking for a way to do that without tampering with the missions myself (that will be cheating, wont it?)

Well, "tampering" as in hacking into the missions after they've been sent out to players would definitely be cheating.

What I was saying is that I'm pretty sure I know of a way to design a mission that would have this feature, but unfortunately it looks as though that's not what you're looking for. :(

Good luck. :good:
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Re: [Question]Making a bind key to a known script
« Reply #6 on: 06 Jun 2010, 12:20:37 »
Woah Woah, slow down.

Unless you're strapped for space, then I don't see why you couldn't just use the radio stuff. 0-0-1 etc.

But I don't think you understood my first post correctly. There should be no problem in executing that script for each player. If the problem arises that you do not know what units will need to execute the script, then create a trigger that engulfs the whole map and put it for anyone to activate. Then put in the execution line the words "_x exec {keyscript.sqs}" forEach thisList. Then change the script so that it says:
Code: [Select]
_p = _this select 0
@(_p == player)
#LOOP
_x = 0
~1
@(_p == player)
_x = call loadfile ":input getkey X"
? _x = 1 : [_p] exec "thescript.sqs"
goto "LOOP"

If that's too much hassle, then why don't you just exec the script for each player via (player exec "keyscript.sqs") in the init.
Snarling creature, lurking in the background, still writing in .sqs

Offline MadBafla

  • Members
  • *
Re: [Question]Making a bind key to a known script
« Reply #7 on: 06 Jun 2010, 21:12:04 »
Thank you RKurtzDmitriyev
And about what you said, lonewolf, the problem with the methods you gave me, I understand them, but if you'll read 2 messages above if I'm not mistaken, you'll meet this:
...
But to the point:
Yes.. I am asking for a way to do that without tampering with the missions myself (that will be cheating, wont it?) and I am not thinking about making my own mission because my knowledge in scripting etc. is very low.

I'm not building a mission because when I tried I saw there are a lot of scripts I don't know and don't have time to learn so I just decided to live with what's on.
I want to make key-binded chat messages. I thought about the Custom radio messages, but the problem is I can't use certain charecters such as "*" or ' for instance and that's a bit of a trouble.
The point is I need to run the file with no regard to the mission and I wish it was key-binded.

Is there any way to do that?

Thanks again
MadBafla :cool2:

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: [Question]Making a bind key to a known script
« Reply #8 on: 06 Jun 2010, 22:28:11 »
Can't remember how flexible OFP eventhandlers are (haven't touched OFP editing in years) but it might be possible to create an addon that uses fWatch and adds a init event for example for all man class units that then executes that fWatch loop mentioned earlier. Done like this any mission using soldiers will activate the addon.

This way you don't have to edit the missions themselves but if you're not capable of mission editing I think coding an addon is not really a possibility since it's generally be far more complex (creating a mission doesn't necessarily require one single script btw). :dunno:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Lone~Wolf

  • Mission Tools & Mods
  • Members
  • *
  • Vladimir Dmitri Mikhail Andreevich Stamenov
Re: [Question]Making a bind key to a known script
« Reply #9 on: 08 Jun 2010, 20:36:05 »
Don't forget that all scripts placed in a folder named "Scripts" in the OFP directory are universal to all missions on the computer. Therefore you could make the necessary script and put it there so you don't have to spend time uploading it for every mission.

I once considered making an OFPR MP mission which exploited that for a sort of show-me-yer-moves sort of thing, where everyone came up with their own superpowers or whatever and simply named a script to execute their powers in their script folder as "INIT_PLAYER_POWERS.sqs". Because each computer could not find the necessary script in the mission folder, it grabbed the LOCAL file from Scripts. This allowed different files, each on the local computers to run. I tested this out with a bunch of computers and it does work!

Fun, innit?  ;)
Snarling creature, lurking in the background, still writing in .sqs

Offline MadBafla

  • Members
  • *
Re: [Question]Making a bind key to a known script
« Reply #10 on: 28 Jun 2010, 12:40:16 »
Don't forget that all scripts placed in a folder named "Scripts" in the OFP directory are universal to all missions on the computer. Therefore you could make the necessary script and put it there so you don't have to spend time uploading it for every mission.
...

Sorry for super late delay I'm undergoing final exams, so the Operation Flashpoint deal of my life is kinda on stand-by :]
                                                           ^
Anyway, about what you just said lonewolf  |
I'm not sure I understand how this folder works... I didn't have 1 on my install so I created one named "Scripts" on my root ofp folder, but what should I do from here? but the script with the loop checking for key pressing like written above? should I still make an addon using fWatch? how do I do that etc.

If these question are noob I'm sorry cause I'm tring to use tutorial but can't seem to find those who can give me info about my question

Thanks again, in advance

*bump
no1 can help me :\?
« Last Edit: 30 Jun 2010, 23:08:53 by MadBafla »

Offline faguss

  • Members
  • *
    • Faguss' Website
Re: [Question]Making a bind key to a known script
« Reply #11 on: 05 Jun 2012, 16:15:08 »
Not possible without making a mod (that all players would have) OR modifying all multiplayer missions.

Anyway, I've wrote an example:
http://ofp-faguss.com/files/CustomChatMsgFwatch.Intro.zip

F1-F10 keys send messages and other players will see them. Fwatch 1.1 is necessary for broadcasting messages but NOT for receiving them. Will work with respawn.