nerevar / jmc

JMC - Jaba Mud Client
26 stars 14 forks source link

Python scripting support #92

Open superradish opened 1 year ago

superradish commented 1 year ago

this should be put in. makes sense to me. bit over my head but i'll give it a try

mlengle commented 1 year ago

currently it's beyond jmc, the app just relies on windows scripting engine, for some odd reason python (Active Python) does not work properly inside windows scripting host and no one cares.

konelav commented 1 year ago

I agree that Python is great for MUD automation, and it works with JMC via Active Script. Try to do the following:

  1. Install python (I tested 2.7 and 3.8 on Win 7, 32-bit versions).
  2. Execute in shell (cmd.exe) pip install pywin32, or if PATH not properly set, something like C:\Python27\python.exe C:\Python27\Scripts\pip.exe install pywin32.
  3. Execute in shell from Python directory python Lib\site-packages\win32comext\axscript\client\pyscript.py.
  4. Restart JMC: now you should be able to select Python as scripting engine.

(taken from here)

Workflow is very similar to JS, e.g.:

def OnIncoming():
    global jmc
    prefix = '#event '
    if jmc.Event.startswith(prefix):
        data = jmc.Event[len(prefix):]
        jmc.ShowMe('System event captured: {}'.format(data))
        jmc.Event = None

jmc.RegisterHandler('Incoming', 'OnIncoming()')
morfozoid commented 1 month ago

Hi, what about groovy as scripting engine, is it possible?