greet script

2005-11-07
2013-04-30
  • Jim Showalter

    Jim Showalter - 2005-11-07

    Here's a two line Java Bean Shell Script that greets your opponents by name on both FICS and ICC.

    Script Name: greet

    Event Type:  Game

    Event Subtypes: Game Start

    Code:

    if (gameType.equals("my") && !oppName.equals("void") )
      {
        sendCommand( "tell " + oppName + " Hi " + oppName + "!");
      }

     
    • Alexander Maryanovsky

      Why the comparison of oppName to "void"? It's actually meaningless (you are comparing it to literally the string "void", so you would not greet an opponent named "void"). You should check isPlayed or (oppName != null) instead.

       
    • Jim Showalter

      Jim Showalter - 2005-11-08

      Ok - I'll try one of those.  The reason I'm checking for the value to be "void" is because that's exactly what oppName is when I examine a game. :)   And it worked under a couple days testing on both servers.

       
    • Jim Showalter

      Jim Showalter - 2005-11-08

      Ok, per Alex's suggestion - thanks sahsa! - I'm using isPlayed, which is a nice boolean variable.  Tested with observed, examined and played games, and it behaved.  But so did the other one. :)

      Type: Bean shell
      Script Name: greet
      Event Type: Game
      Event Subtypes: Game Start
      Code:
      if (gameType.equals("my") && isPlayed )
        {
          sendCommand( "tell " + oppName + " Hi " + oppName + "!");
        }

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks