Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower level interfacing #16

Closed
Tirpitz93 opened this issue Oct 19, 2017 · 5 comments
Closed

Lower level interfacing #16

Tirpitz93 opened this issue Oct 19, 2017 · 5 comments

Comments

@Tirpitz93
Copy link

Hello,
If I am missing the point completely here I apologize, but is it possible to, for example create a group or unit in python directly? or just return primitive datatypes?
Is this possible currently, will it be possible, can I help make it possible?
and is it possible to hook into events such as pre init, post init and event handlers such as hit and killed?
Cheers.
Lonja

@Adanteh
Copy link
Collaborator

Adanteh commented Oct 19, 2017

This is just for calling python files from within arma. pythia doesn't have direct access to anything of the game's information (And can't do anything to the game itself). For that you'll need to wait till Intercept-python comes out. All the hooking into events is possible, but you'll have to add events yourself and just do a callExtension. Basically

player addEventHandler ["Killed", { ['pythonFolder'] call py3_fnc_callExtension;

or

class cfgFunctions {
class YOURTAG {
class Category {
class someFunction { preinit = 1 };
};
};
};

as a normal preinit function.

@Tirpitz93
Copy link
Author

Thanks, Yeah I thought so, is intercept-python an ongoing project or is it a semi planned future project?

@overfl0
Copy link
Owner

overfl0 commented Oct 19, 2017

To answer your last question regarding intercept:
Intercept-python is currently a semi-planned future project that I'm part of but haven't had the time to do anything with it yet :(.
I hope other developers will have more time than me. I would say that intercept-python surely won't be in a usable state within the next few months (more like half a year).


And to answer your previous question, besides what Adanteh already said:

There was a branch that allowed you to call SQF code directly from python, albeit not very efficiently:
https://github.com/overfl0/Pythia/blob/master/src/python/coroutines.py#L47-L60

The way it worked was to return to the SQF engine, perform the action and then to do a callExtension again.
To be honest, I don't even remember if it still works (it should, though :P). It did the job during early tests but you would have to check it yourself, and use another calling function for sure (see fn_callEx.sqf). I don't know how up to date that function is, though.

The current status of Pythia is that it is used as a testing ground for Dynamic Frontline, our mod that uses python to simulate a gigantic capture zone, and we're modifying Pythia according to the needs of that mod (or not modifying it because it currently works good enough for all our needs).
https://www.youtube.com/watch?v=QFnIBkKlEgQ

However, if someone else comes in, with different needs, I may consider fixing the issues they are having and I will surely assist them should they want to submit PR or need assistance in doing so.

To sum it all up:
If you have medium-to-heavy python calls that you want to call rather seldomly, and don't want to wait half a year, do use Pythia.
If you have LOTS of small python calls that you would like to do or can wait half a year, then wait for python-intercept.

@Tirpitz93
Copy link
Author

Tirpitz93 commented Oct 19, 2017

I would like to contribute to the development of Intercept-Python if at all possible, is there a repo that I could fork?
Ideally I would like to be able to do all scripting & mission flow in python. I was looking at using SWIG to wrap intercept, and then embed a python interpreter in intercept to interpret the code.

@Tirpitz93 Tirpitz93 changed the title Creating units etc Lower level interfacing Oct 19, 2017
@overfl0
Copy link
Owner

overfl0 commented Oct 20, 2017

Hi, I was about to answer you but I've just noticed that you've already found it.
See you in the intercept slack channel, in that case :)

@overfl0 overfl0 closed this as completed Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants