Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

[Nexus] Plant detection using Javascript

MelquiadesMelquiades Member Posts: 4

Is there a way to acquire plant information in a room when onGCMP() is called?

If so then is there a way to persist the list of plants in a room so that it can be accesed by other scripts excuted when the event roomChanged is triggered?


  • AntoniusAntonius Member Posts: 5,040 @@ - Legendary Achaean

    Generally speaking, you can determine the plants in a room based on the environment type of the room (which is in GMCP under Room.Info.environment). There are some rooms that are that environment type but don't have plants in them, but they're pretty uncommon. Here's the lookup table I use in my harvesting script:

    environments = {
    	["Desert"] = {"pear", "weed"},
    	["Mountains"] = {"valerian"},
    	["Natural underground"] = {"moss", "bloodroot", "lumic"},
    	["Forest"] = {"ginseng", "ginger", "myrrh", "lobelia", "elm"},
    	["Garden"] = {"ginseng", "ginger", "myrrh", "lobelia", "elm"},
    	["Grasslands"] = {"goldenseal", "slipper"},
    	["Valley"] = {"sileris"},
    	["Jungle"] = {"kuzu", "kola", "skullcap"},
    	["Freshwater"] = {"kelp"},
    	["Ocean"] = {"kelp"},
    	["River"] = {"kelp"},
    	["Hills"] = {"bayberry", "hawthorn"},
    	["Swamp"] = {"cohosh", "bellwort", "ash"}

    It's in Lua so you'd need to change it to be valid JavaScript.

  • MelquiadesMelquiades Member Posts: 4
    Thanks... It seems the way to start doing this is;

    onGMCP {
    if (args.gmcp_method == "Room.Info") {
        client.set_variable('current_environment', args.gmcp_args.environment);

    the current_environment variable can then be used in a switch statement.

Sign In to Comment.