Username: Password:

Author Topic: [Tutorial] Link scripts.  (Read 3090 times)

Offline MikeOwh

  • Administrator
  • Wolf
  • *****
  • Posts: 156
  • Cookies 10001
  • The DemonLord himself.
    • View Profile
    • OwhTool
[Tutorial] Link scripts.
« 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.")

« Last Edit: June 05, 2023, 05:05:00 PM by MikeOwh »