SquidDev-CC / CCTweaks

Random additions to ComputerCraft (somewhat deprecated, use CC-Tweaked if you're on Minecraft 1.12).
MIT License
12 stars 2 forks source link

Expanded command system #105

Closed SquidDev closed 7 years ago

SquidDev commented 8 years ago

See #7 and #102

dirthsj commented 8 years ago

Perhaps the ability to get the block the player is viewing (if any)? I have a rather hackish method which assumes all blocks are full blocks - it will fail if the player is looking past a torch, or something similar.

SquidDev commented 7 years ago

@KingofGamesYami With respect to scoreboards: are you aware of /scoreboard players list <player name>? This lists all scoreboard values for a particular player and could be parsed to get the relevant data.

With respect to looking at blocks, I'd rather stick most metadata gathering in Plethora so I'm not going to add that.

dirthsj commented 7 years ago

At the moment, this actually seems to work:


function getScoreboardValue( playerName, objectiveName )
  local ok, result = commands.scoreboard( "players list", playerName )
  table.remove( result, 1 )
  for i, str in ipairs( result ) do
    print( str )
    if( str:match( "^- " .. objectiveName .. ":" ) ) then
      return str:match( ": (.+) %(" )
    end
  end
end
SquidDev commented 7 years ago

Right, I think I've decided that I'm not going to implement this: most of this can be done with Plethora or existing commands.