Git Product home page Git Product logo

Comments (3)

gilesknap avatar gilesknap commented on June 12, 2024

@jhutar this seems to still be working for me.

Please can you post the output when you try this. Thanks.

(venv) (dev) [giles@ws1 mciwb]$ mciwb shell --debug --server nuc2.lan --port 30555 --player TransformerScorn --passwd spider
DEBUG: /home/giles/work/mciwb/src/mciwb/logging.py:26 init_logging 
        Debugging logging initialized
INFO: /home/giles/work/mciwb/src/mciwb/iwb.py:108 connect 
        Connected to nuc2.lan on 30555
ERROR: /home/giles/work/mciwb/src/mciwb/iwb.py:161 add_player 
        failed to give signs to player, 
INFO: /home/giles/work/mciwb/src/mciwb/iwb.py:163 add_player 
        Monitoring player TransformerScorn enabled for sign commands
INFO: /home/giles/work/mciwb/src/mciwb/__main__.py:84 shell 
        ######### Starting Interactive Session ##########

Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.10.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: world.add_player('TransformerScorn')
DEBUG: /home/giles/work/mciwb/src/mciwb/monitor.py:74 start_poller 
        starting polling thread TransformerScorn
INFO: /home/giles/work/mciwb/src/mciwb/iwb.py:163 add_player 
        Monitoring player TransformerScorn enabled for sign commands

In [2]: pos = world.player.pos

In [3]: pos
Out[3]: Vec3(x=633, y=73, z=-1651)

In [4]: 

from mciwb.

gilesknap avatar gilesknap commented on June 12, 2024

I just re-read your post on this and it looks like you are trying to call world.player.pos without doing an add_player first.

In that case the error would be expected but I probably should trap that and give a better error.

You either need to start with the player logged in or use add_player once you log in. Note also that you can add_player for multiple users so they can all use signs etc. (I use multi-player to have exploding snowball fights with my son).

There is no automatic monitoring of players joining - I guess we could implement that though.

from mciwb.

gilesknap avatar gilesknap commented on June 12, 2024

Also:

I detect when a player leaves but fail to clean up the player list in world.

TODO add a monitor which runs list once every 5 secs and parses the output to determine the current list of players and update world.players accordingly (including killing exiting players monitors).

Question: how do we determine which is the 'primary' player i.e. world.player ?? Maybe we should not have primary player - but it is mighty convenient for the most common case of accessing a single player.

In [1]: world
Out[1]: 
Minecraft Interactive World Builder status:
  copy buffer start: None
  copy buffer stop: None
  copy buffer size: Vec3(x=0, y=0, z=0)
  paste point: None
  player: TransformerScorn
    position: Vec3(x=633, y=73, z=-1651)
    facing: Vec3(x=0, y=0, z=1)

In [2]: WARNING:        player TransformerScorn left
INFO:   Monitor TransformerScorn stopped
In [2]: 

In [2]: world
Out[2]: Traceback (most recent call last):
  File "/home/giles/work/mciwb/venv/lib/python3.10/site-packages/IPython/core/formatters.py", line 221, in catch_format_error
    r = method(self, *args, **kwargs)
  File "/home/giles/work/mciwb/venv/lib/python3.10/site-packages/IPython/core/formatters.py", line 706, in __call__
    printer.pretty(obj)
  File "/home/giles/work/mciwb/venv/lib/python3.10/site-packages/IPython/lib/pretty.py", line 410, in pretty
    return _repr_pprint(obj, self, cycle)
  File "/home/giles/work/mciwb/venv/lib/python3.10/site-packages/IPython/lib/pretty.py", line 778, in _repr_pprint
    output = repr(obj)
  File "/home/giles/work/mciwb/src/mciwb/iwb.py", line 239, in __repr__
    f"    position: {player.pos}\n"
  File "/home/giles/work/mciwb/src/mciwb/player.py", line 80, in pos
    return self.pos_f.with_ints()
  File "/home/giles/work/mciwb/src/mciwb/player.py", line 72, in pos_f
    match = self._get_entity_data("Pos", regex_coord)
  File "/home/giles/work/mciwb/src/mciwb/player.py", line 56, in _get_entity_data
    raise PlayerNotInWorld(f"player {self.name} left")
mciwb.player.PlayerNotInWorld: player TransformerScorn left

from mciwb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.