[Plugin] FGW Helper

The “FGW Helper” plugin for phBot automates certain actions for specific characters when they join the game. Here’s a quick summary:

  1. Character List Management:
  • Maintains a list of XX specific character names, including dynamically generated names and additional predefined ones.
  1. Actions on Character Join:
  • When a character from the list joins the game:
    • Sets the training area to the Forgotten World (FGW) after 20 seconds.
    • Attempts to use a return scroll after 30 seconds.
    • Starts the bot 35 seconds after setting the training area.
  • Logs these actions for monitoring.
  1. Initialization:
  • Logs that the plugin is loaded.
  • Checks the name of the currently loaded character and, if it matches one in the list, calls the function to perform the specified actions.

In summary, this plugin ensures that designated characters automatically set their training area to FGW, start the bot, and use a return scroll with specific delays after joining the game.

NOTE: Edit your time

from phBot import *
from threading import Timer

# Generate the list of character names
character_names = ['Player' + str(i) for i in range(1, 41)] 
additional_names = ['CHAR1', 'CHAR2', 'CHAR3', 'CHAR4', 'CHAR5', 'CHAR6', 'CHAR7']  # List of additional names
character_names.extend(additional_names)  # Adding additional names to the list

def set_area_plugin(args):
    set_training_area(args)
    log('[' + plugin_name + '] Script area changed to [' + args + ']')
    Timer(25.0, start_bot).start()  # Start bot after 25 seconds
    return 0

# Function called when the user successfully selects a character
def joined_game():
    # Get the character name
    character_name = get_character_data()['name']
    
    # Check if the character name is in the list
    if character_name in character_names:
        log('[' + plugin_name + '] Character [' + character_name + '] joined. Setting area to FGW with a delay of 20 seconds.')
        Timer(20.0, set_area_plugin, args=['FGW']).start()  # Set area to FGW after 20 seconds
        Timer(30.0, attempt_use_return_scroll).start()  # Use return scroll after 30 seconds
    else:
        log('[' + plugin_name + '] Character [' + character_name + '] joined. Bot start skipped.')
    
    return 0

def attempt_use_return_scroll():
    if use_return_scroll():
        log('[' + plugin_name + '] Return scroll used successfully.')
    else:
        log('[' + plugin_name + '] Failed to use return scroll. None may be available in inventory.')
    return 0

# Plugin name
plugin_name = 'FGW Helper'

# Plugin loaded message
log('[' + plugin_name + '] Plugin loaded.')

# Start the bot immediately upon loading the plugin only for specific characters
character_name = get_character_data()['name']
if character_name in character_names:
    joined_game()
else:
    log('[' + plugin_name + '] Character [' + character_name + '] loaded. Bot start skipped.')

Extra related links:

2 Likes