Mindee-BOT

Mindee-BOT Community => Scripting => Tutorials => Topic started by: MikeOwh on October 24, 2020, 01:02:06 am

Title: [Tutorial] Link scripts.
Post by: MikeOwh on October 24, 2020, 01:02:06 am
To link two scripts, the content must be grouped in the corresponding def.
For example you have these two scripts:


Script 1:
Code: [Select]
# Locations
loc_hunt = (32003, 30293, 7)

# Waypoints
way_to_hunt = 0
way_in_hunt = 1
way_to_shop = 2


def onScriptActivation():
    script.IgnoreMonsters(False)


def onChangeLocation(x, y, z):
    loc = (x, y, z)
    way = script.GetWay()

    if (loc == loc_hunt) and (way == way_in_hunt):
        script.StatusMessage("You are in the hunting area.")



Script 2:
Code: [Select]
# Locations
loc_shop = (32457, 31874, 7)

# Waypoints
way_to_hunt = 0
way_in_hunt = 1
way_to_shop = 2


def onScriptActivation():
    script.PZChecksForDrop(True)


def onChangeLocation(x, y, z):
    loc = Location(x, y, z)
    way = script.GetWay()

    if (loc == loc_shop) and (way == way_to_shop):
        script.StatusMessage("You are in the shop.")


Result:
Code: [Select]
# Locations
loc_hunt = (32003, 30293, 7)
loc_shop = (32457, 31874, 7)

# Waypoints
way_to_hunt = 0
way_in_hunt = 1
way_to_shop = 2


def onScriptActivation():
    script.IgnoreMonsters(False)
    script.PZChecksForDrop(True)


def onChangeLocation(x, y, z):
    loc = Location(x, y, z)
    way = script.GetWay()

    if (loc == loc_hunt) and (way == way_in_hunt):
        script.StatusMessage("You are in the hunting area.")

    elif (loc == loc_shop) and (way == way_to_shop):
        script.StatusMessage("You are in the shop.")