drone.sign
nixnax opened this issue ยท 9 comments
drone.sign displays only the first line, e.g
drone.sign( [ "Welcome", "to", "Scriptopia" ], 68 )
displays only "Welcome" on the first line.
This workaround gets text on all 4 lines:
/js aa=box(1).sign("",68).back(1) // create a sign on the box, then step back 1 to get its position
/js bb=aa.world.getBlockAt(aa.getLocation()) // get a handle to the sign object
/js bb.tileEntity.setText(["abc","def","ghi", "jkl"])
/js bb.tileEntity.update()
C:\Users\user>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows 8.1
OS Version: 6.3.9600 N/A Build 9600
C:\Users\user>java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
And this seems to work just fine
utils = require('utils')
exports.a = function () {
var my_cursor = utils.getMousePos()
var my_world = server.getDefaultWorld()
var my_block = my_world.getBlockAt(my_cursor)
var my_tile = my_block.getTileEntity()
var my_time = my_world.totalTime.toString()
for (i = 0; i < 4; i++ ) {
my_tile.setTextOnLine(my_time, i)
my_tile.update()
}
}
More info: For this code in drone.js (case __plugin.canary)
setLine = function( block, i, text)
console.log("In function setLine")
console.log("Block = " + block)
console.log("i = " + i)
console.log("text = " + text)
var mysign = block.getTileEntity();
console.log( "sign = " + mysign )
mysign.setTextOnLine( text, i );
console.log( "After setTextOnLine... sign = " + mysign)
mysign.update();
console.log( "After sign.update... sign = " + mysign )
};
I see this error - which is probably why only the first line gets written
[INFO]: In function setLine
[INFO]: Block = Block[Type=minecraft:wall_sign, data=2, x=3000015, y=63, z=2999997, world=default, dim=NORMAL]
[INFO]: i = 0
[INFO]: text = AAAAAA
[INFO]: sign = Sign[X=3000015 Y=63 Z=2999997 SignType=WallSign Text1= Text2= Text3= Text4=]
[INFO]: After setTextOnLine... sign = Sign[X=3000015 Y=63 Z=2999997 SignType=WallSign Text1=AAAAAA Text2= Text3= Text4=]
[INFO]: After sign.update... sign = Sign[X=3000015 Y=63 Z=2999997 SignType=WallSign Text1=AAAAAA Text2= Text3= Text4=]
[INFO]: Drone build error: java.util.IllegalFormatConversionException: d != java.lang.Double
I found the issue in drone.js
setLine = function( block, i, text) {
var sign = block.getTileEntity();
sign.setTextOnLine( text, i );
sign.upate(); // <<<<< SHOULD HAVE BEEN update()
};
There were two erroneous instances of upate()
Don't you mean drone/sign.js ? Do you have the latest code? I only see one update() call.