+ Reply to Thread
Results 1 to 4 of 4

Thread: Current shard

  1. #1
    Soulwalker
    Join Date
    Aug 2011
    Posts
    3

    Default Current shard

    I was wondering whether there's a command that will return the name of the shard that I am currently on, similar to the way the /shard command works.

    Right now, Inspect.Shard().name returns the person's "home" shard. Can it be modified to return the current shard, or is there a way to run the /shard command within a script?

    Thanks!

  2. #2
    Ascendant SoulshadowDK's Avatar
    Join Date
    Jun 2011
    Posts
    1,453

    Default

    nevermind, I cant read
    Last edited by SoulshadowDK; 09-13-2013 at 01:45 PM.
    Soulraiser - 60 Cleric // Soulslayer - 60 Warrior // Soulshadow 60 Mage
    Faeblight NA
    http://www.dargaardknights.com
    Visit our recruiting thread HERE

  3. #3
    Wym
    Wym is offline
    Shadowlander
    Join Date
    Jun 2012
    Posts
    25

    Default

    In my WhereAmI Addon, i had exactly that problem. I solved it by looking at the name of the /1 chat .. if it contains a @, the current shard is the part behind the @; if it doesn't, the current shard is Inspect.System.Shard().
    Code:
    		local player=Inspect.Unit.Detail("player")
    		if not player.zone then return end
    		local zone=Inspect.Zone.Detail(player.zone)
    		if not zone.name then return end
    
    		local newShardName
    		local consoles=Inspect.Console.List()
    		for cid, flag in pairs(consoles) do
    			-- print ("cid=="..cid)
    			local console=Inspect.Console.Detail(cid)
    			-- dump(console)
    			if console.channel then
    				for cname, flag in pairs(console.channel) do
    					if cname == zone.name then
    						-- we are in the zone channel of our home server
    						local shard=Inspect.Shard()
    						newShardName=shard and shard.name
    					elseif (cname:sub(1, zone.name:len()+1) == zone.name.."@") then
    						-- we are in a "zone@server" channel
    						newShardName=cname:sub(zone.name:len()+2)
    					end
    				end
    			end
    		end
    		if newShardName and newShardName ~= shardName then
    			WhereAmI.setShard(newShardName)
    			shardName=newShardName
    		end

  4. #4
    Soulwalker
    Join Date
    Aug 2011
    Posts
    3

    Default

    Quote Originally Posted by Wym View Post
    In my WhereAmI Addon, i had exactly that problem. I solved it by looking at the name of the /1 chat .. if it contains a @, the current shard is the part behind the @; if it doesn't, the current shard is Inspect.System.Shard().
    I never noticed that /1 switched you into chat of the shard you joined. That seems like a good way to work around the problem, thanks for the help!

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts