These functions provide a quick and easy way to hook into parts of WorldEdit/WorldGuard and require the SKCompat extension. All of these commands are prefixed by "sk_".
If you use WorldEdit regularly, all these functions should be very familiar. Anyway, let's start off with something simple, sk_pos1.
sk_pos1() #returns the pos1 of the player
Using it like that will return a location array of the current player's position 1. The array is formatted as follows: x, y, z, world. To set the position 1 of a player, you will need to specify a location array. Let's set the position 1 of a player named 'player' to 0, 0, 0.
sk_pos1('player', array(0, 0, 0))
That was easy! What if we want to set it to the player's current position? That's easy as well, let's just use ploc().
assign(@pname, 'player') #we're using player for this example sk_pos1(@pname, ploc(@pname)) #use ploc to set player's position 1 to his current location
All the above applies to sk_pos2 as well, it is used exactly the same way. For example
sk_pos2() #returns the player's position 2
Note that both of these functions can return a PlayerOfflineException or a CastException.
What if we want a list of all the regions? That's easy enough, just use sk_all_regions(). That will return an array of all the regions in all the worlds. What if we wanted to get all the regions in only one world, though? Just use sk_all_regions(world)
sk_all_regions('world') #returns an array of all the regions for the world 'world'
To see what regions a player is in, use sk_current_regions(player). If a player is not specified, the current player is used.
sk_current_regions('player') #returns an array of the regions player is in
Once you have a region name and world, you can get info about it using sk_region_info(region_name, world). This command returns the following:
- 0 - An array of points that define this region
- 1 - An array of owners of this region
- 2 - An array of members of this region
- 3 - An array of arrays of this region's flags, where each array is: array(flag_name, value)
- 4 - This region's priority
- 5 - The volume of this region (in meters cubed)
More functions are being added all the time. See the extension page for more information.