Page 1 of 1

[SCRIPT] Where am I

Posted: Wed Oct 02, 2013 5:28 pm
by Kuma
This is my first script (I feel so good) Thanks to VladVP and Leif for teaching me the basics!
This script returns the x, y, z value of the block you attempt to destroy with the spade. Made for map makers and scripters as a replacement for the /where command

The commands are:
/whereami - enables/disables the scripts
/wai - same as above
Code: Select all
#Where am I script by Kuma
#Version 2.0

from commands import alias, add, name

@alias('wai')
def whereami(connection):
    protocol = connection.protocol
    if connection in protocol.players:
        player = connection
    else:
        raise ValueError()
    player.whereami = not player.whereami

    message = 'now in where am I mode' if player.whereami else 'no longer in where am I mode'
    player.send_chat("You are {0}".format(message))

add(whereami)    

def apply_script(protocol, connection, config):
    class whereConnection(connection):
        whereami = False
        def on_block_destroy(self, x, y, z, mode):
            if self.whereami:
                self.send_chat("X = {0}, Y = {1}, Z = {2}".format(x, y, z))
                return False
            else:
                return connection.on_block_destroy(self, x, y, z, mode)
    return protocol, whereConnection

Re: [SCRIPT] Where am I

Posted: Fri Oct 04, 2013 9:51 am
by Kuma
There is a major bug in the script please don't use it, bug is that if you enable it it enables it for ALL users I am fixing that atm
fixed

Re: [SCRIPT] Where am I

Posted: Fri Oct 04, 2013 9:54 am
by learn_more
either store it in an array (globally), but also have to update that on join / exit,
or store it in the player object.

Re: [SCRIPT] Where am I

Posted: Fri Oct 04, 2013 10:02 am
by Kuma
learn_more wrote:
either store it in an array (globally), but also have to update that on join / exit,
or store it in the player object.
I did the player object method, too late :3
I was editing the post, you posted this when I was finished

Re: [SCRIPT] Where am I

Posted: Sat Oct 05, 2013 8:31 am
by thepolm3
good job!

Re: [SCRIPT] Where am I

Posted: Sat Oct 05, 2013 9:09 am
by Kuma
thepolm3 wrote:
good job!
MY LIFE IS COMPLETE POLM COMPLEMENTED ME!!!!!

Re: [SCRIPT] Where am I

Posted: Sat Oct 05, 2013 9:26 am
by thepolm3
Kuma wrote:
thepolm3 wrote:
good job!
MY LIFE IS COMPLETE POLM COMPLEMENTED ME!!!!!
MY LIFE IS COMPLETE SOMEONE IDOLIZES ME <3