VarScript Variables (javascript/groovy) Help

Discussion in 'Bukkit Help' started by mistermsk, Mar 10, 2014.

Thread Status:
Not open for further replies.
  1. Offline


    Hi All,

    I have installed the plugin VarScript. I will say this has a really big potential for my server. Anyway, I am at a loss for variables. I see .setHealth and .GetSpawnLocation from the description of the plugin. However, I am at a loss to find where to find the variables to set or get.

    For instance. For Player ABC I want to set gamemode to survival. I tried

    > js server.getPlayer("ABC").setGameMode(0)

    as well as .setgamemode and .setGamemode. All give me an error. However, I know the syntax is write since the below works.

    > js server.getPlayer("ABC").setHealth(5)

    Even if I have to use Groovy, that is fine, too. However, is there a website that shows all the variables that can be set?

    Thank you.
  2. Offline


    mistermsk see

    Correct commands to change gamemode:
    /js> ABC.setGameMode(org.bukkit.GameMode.ADVENTURE)
    /g> ABC.gameMode = org.bukkit.GameMode.ADVENTURE

    You can create file ./plugins/VarScript/scripts/setGM.groovy
    1. import org.bukkit.GameMode
    2. // function to change gamemode
    3. setgm = { String playerName, int mode ->
    4. def player = server.getPlayer(playerName)
    5. player.gameMode = GameMode.getByValue(mode)
    6. }
    run script at once:
    />> setGM.groovy
    and use the function at any time:
    /g> setgm "ABC", 2

    soon I will release an extension that simplifies use Groovy.
    /g> me.spawn "Zombie" // spawn zombie beside
    /g> = "adv" // change game mode to adventure
    /g> kill ABC // kill player ABC
    /g> mobs.each { it.explode 1.75 } // explode all mobs
  3. Offline


    Thanks so much. That really helps.
Thread Status:
Not open for further replies.

Share This Page