ScriptCraft

ScriptCraft

14.6k Downloads

drone.sign

nixnax opened this issue ยท 9 comments

commented

drone.sign displays only the first line, e.g

drone.sign( [ "Welcome", "to", "Scriptopia" ], 68 )

displays only "Welcome" on the first line.

commented

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()
commented

What OS and java version are you using?

commented
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)
commented

I can't reproduce this with Windows 7 professional w/ JDK 1.8.0_25

commented

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()
  }
}
commented

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
commented

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()

commented

Don't you mean drone/sign.js ? Do you have the latest code? I only see one update() call.

commented

No this bug was in the previous release.
I think you fixed it in the past few days.
I just checked 3.0.2 Release (2014 12 28) and it's fixed.
Thanks for an awesome plugin.