Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

setText per tick

Comments in 'Plugin Development' started by GamesLoad, May 8, 2016.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    Hello guys I wanted to know if it is a sign can put each tick can you help me to do so I could not figure out how to do it on a sign but only on a block.
  2. Inta
    Offline

    Inta Active Member

    Joined:
    Feb 11, 2016
    Posts:
    84
    Minecraft User:
    InstantlyTa
    So you want to update Sign texts each tick? Or "Replace sign each tick"?
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Definitely update. Create a new repeating task and set interval to 20, because 1 tick will be too small amount, making server lag.

    Save tiles of signs into an array which can be accessed from your task object. All you have to do is update it.
    PHP:
    foreach( $signTiles as $tile ) {
        
    $tile->setText("Line one""Line two""Line three""Line four");
    }
  4. Inta
    Offline

    Inta Active Member

    Joined:
    Feb 11, 2016
    Posts:
    84
    Minecraft User:
    InstantlyTa
    Yea i just notice that he said "I could not figure out how to do it on a sign but only on a block" so i just wonder ..
  5. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    is for tick
    tick 1
    text[0] == "test1"
    tick 2
    text[1] == "test2"
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    // Context of \pocketmine\scheduler\task\PluginTask
    public function onRun($currentTick){
        
    /** @var \pocketmine\tile\Sign[] $signTiles */
        
    foreach( $signTiles as $tile ) {
            
    $tile->setText("Ticks: ".$currentTick"Seconds: ".($currentTick 20), "Minutes: ".($currentTick 20 60), "Hours: ".($currentTick 20 60 60));
        }
    }
  7. asyven
    Offline

    asyven New Member

    Joined:
    Jan 17, 2015
    Posts:
    29
    Minecraft User:
    asyven
  8. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    so no I do not think you can do I have to use the switch block
    swtich ($ ticks) {
    case '1':
    $Sign->setText ("hello","","","");
    case '2':
    $Sign->setText ("ello h","","","");
    case '3':
    $Sign->setText ("llo he","","","");
  9. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    You want to make scrolling message?
  10. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    yes in sign

Share This Page

Advertisement