[SCRIPT] Where am I

Intended for use on live public servers.
7 posts Page 1 of 1 First unread post
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


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
Last edited by Kuma on Fri Oct 04, 2013 10:05 am, edited 2 times in total.
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


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
Last edited by Kuma on Fri Oct 04, 2013 10:01 am, edited 2 times in total.
learn_more
Coder
Coder
Posts: 891
Joined: Sun Mar 24, 2013 9:59 pm


either store it in an array (globally), but also have to update that on join / exit,
or store it in the player object.
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


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
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


good job!
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


thepolm3 wrote:
good job!
MY LIFE IS COMPLETE POLM COMPLEMENTED ME!!!!!
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


Kuma wrote:
thepolm3 wrote:
good job!
MY LIFE IS COMPLETE POLM COMPLEMENTED ME!!!!!
MY LIFE IS COMPLETE SOMEONE IDOLIZES ME <3
7 posts Page 1 of 1 First unread post
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 10 guests