wip fix for zoneing in Stillmoon Temple/pok/shadowrest

Discussion in 'E3' started by Casai, Sep 27, 2023.

  1. Casai

    Casai Orc Legionnaire

    Messages:
    109
    note: can probably fix Stillmoon Temple zone trouble by just deleting lines in doors.ini and not touching e3_Basics.inc

    seems to work for me but I havent used this for long. posting since it was a pain to get around

    e3_Basics.inc
    replace click clickIt and oclickit with this
    in Sub basics_Background_Events add /doevents creamclickIt
    Code:
    |----------------------------------------------------------------------------|
    |- decides what click to use                    -|
    |----------------------------------------------------------------------------|
    #EVENT clickIt "<#1#> Click It#2#"
    #EVENT clickIt "#1# tells the group, 'Click It#2#'"
    #EVENT clickIt "#1# tell your party, 'Click It#2#'"
    SUB EVENT_clickIt(line, ChatSender, eventParams)
    |/ehco Zone.ID ${Zone.ID}
    |202 poknowledge Plane of Knowledge
    |187 shadowrest Shadowrest
    |338 Stillmoon Temple
        /if (${Zone.ID} == 202 || ${Zone.ID} == 187) {
            /doevents oldclickIt
     
        } else {
            /doevents creamclickIt
        }
    /return
    |----------------------------------------------------------------------------|
    |- Moves to a given location, and clicks the nearest object.                        -|
    |----------------------------------------------------------------------------|
    #EVENT creamclickit "<#1#> Click It#2#"
    #EVENT creamclickit "#1# tells the group, 'Click It#2#'"
    #EVENT creamclickit "#1# tell your party, 'Click It#2#'"
    SUB EVENT_creamclickit(line, ChatSender, eventParams)
      /declare debug_clickit bool local FALSE
      /if (${line.Find[,]}) /varset line ${line.Left[${Math.Calc[${line.Find[,]}-1]}]} ${line.Right[-${line.Find[,]}]}
      /if (!${checkEventArgs[${ChatSender},${line},UZR,${eventParams}]}) /return
        /if (${c_eventArgChatSender.Equal[${Me}]}) /delay 2s
      /if (${Me.Casting.ID} && ${Me.Class.ShortName.NotEqual[BRD]}) /call interrupt
      /declare i int local
      /declare closestDoorID int local 0
      /declare closestDoorDist float local 0
      |load array of doors from doors.ini:  doorid, x, y, z, name
      /call IniToArrayV "e3 Macro Inis\doors.ini,${Zone.ShortName},${Zone.ShortName}#" doorList
      /echo ${Zone.ShortName}
      /if (${Defined[doorList]}) {
        /if (${debug_clickit}) /echo Doors in zone ${doorList.Size}
        |find the closest door to me
        /for i 1 to ${doorList.Size}
          /if (${debug_clickit}) /echo ${i} ${doorList[${i}]}
          /squelch /doortarget id ${doorList[${i}].Arg[1,,]}
          /if ((${closestDoorDist}==0 || ${DoorTarget.Distance} < ${closestDoorDist}) && ${DoorTarget.DistanceZ} < 125 && ${DoorTarget.Distance} < 400) {
            /varset closestDoorDist ${DoorTarget.Distance}
            /varset closestDoorID ${doorList[${i}].Arg[1,,]}
          }
        /next i
      }
      | if i have a door within 100 distance then move to it and try to click
      /if (${debug_clickit}) /echo closestDoorID ${closestDoorID} closestDoorDist ${closestDoorDist}
      /if (!${Bool[${closestDoorID}]}) {
        /squelch /doortarget
        /if (${DoorTarget.Distance} < ${MaxResponseDist}) {
          /varset closestDoorID ${Switch.ID}
          /if (${debug_clickit}) /echo no door in file, picked closest door ${Switch.ID}
        } else {
          /echo \ay Aborting ClickIt: I could not find an acceptable door < ${MaxResponseDist} units
          /return
        }
      }
      /squelch /doortarget id ${closestDoorID}
       /echo closestDoorID ${closestDoorID} Distance ${DoorTarget.Distance}
      /if (${DoorTarget.Distance} > 20) /call MoveToLoc ${DoorTarget.Y} ${DoorTarget.X} 50 15
      /if (${DoorTarget.Distance} > 35) {
        /echo \ay Aborting ClickIt: I could not moveto < 20 units of ${DoorTarget.Name} within 5s
        /moveto off
        /return
      } else {
        /declare MyZone int local ${Zone.ID}
        /declare clickTimer timer local 7s
        |add starting loc vs final loc for intrazone click
        /declare clickDelay int local ${Math.Calc[${Math.Rand[${Me.ID}]}%${clickitRandomDelay}|1]}
        /declare startingLoc ${Me.Loc}
        :retryClickDoor
        /delay ${clickDelay}
        /squelch /doortarget id ${closestDoorID}
        /squelch /click left door
        /if (${MyZone}==${Zone.ID} && ${Math.Distance[${startingLoc}]} < 10) {
          /if (${clickTimer}) {
            /goto :retryClickDoor
          } else {
            /echo \ay I have failed to click Door ${Switch.ID} ${DoorTarget.Name}
            /moveto off
            /return
          }
        }
      }
    /RETURN
    
    |--------------------------------------------------------------------------|
    |- Moves to a given location, and clicks the nearest object.                      -|
    |- This is only here to support a situation wheres doors.txt lacks a door -|
    |- @param ChatSender: The command sender.                                                    -|
    |- @param locToStart: Where to stand when attempting to click the object.    -|
    |--------------------------------------------------------------------------|
    #EVENT oldclickIt "<#1#> OldClickIt #2#"
    #EVENT oldclickIt "#1# tells the group, 'OldClickIt #2#'"
    #EVENT oldclickIt "#1# tell your party, 'OldClickIt #2#'"
    SUB EVENT_oldclickIt(line, ChatSender, locToStart)
    /echo oldclickIt
      /if (${Debug} || ${Debug_Basics}) /echo |- EVENT_clickIt ==>
      /if (${line.Find[,]}) /varset line ${line.Left[${Math.Calc[${line.Find[,]}-1]}]} ${line.Right[-${line.Find[,]}]}
      /if (!${checkEventArgs[${ChatSender},${line},UZR,${locToStart}]}) /return
      | -Check LoS.
      /if (!${LineOfSight[${Me.Loc.Replace[ ,]}:${c_eventArgData}]}) {
        /docommand ${ChatToggle} I cannot see the object to click.
      } else {
        /if (${locToStart.Find[ ]}) /varset locToStart ${locToStart.Arg[1, ]}
        | -Check range to object.
        /if (${Math.Distance[${locToStart}]} > ${Math.Calc[${MaxResponseDist}*3].Int}) {
            /echo Distance ${Math.Distance[${locToStart}]} /// locToStart ${locToStart}
          /docommand ${ChatToggle} That object is too far away to click.
        } else {
          /declare retryTimer timer local 15s
          /declare miscTimer timer local
          /declare startZone int local ${Zone.ID}
          |/if (${Stick.Active}) /squelch /stick off
            /squelch /stick off
          |/if (${NetAdvPath.Following}) /squelch /netfollow off
            /squelch /netfollow off
          /if (${Me.Casting.ID} && ${Me.Class.ShortName.NotEqual[BRD]}) /call interrupt
          :retryClick
          /if (${Math.Distance[${locToStart}]} > 10) /call MoveToLoc ${locToStart} 30 20
          /if (${Math.Distance[${locToStart}]} > 10) {
            /docommand ${ChatToggle} I failed to move to the inteded object
          } else {
            | -Switch to first person camera.
            /keypress First_Person_Camera
            | -Face object and attempt to click it for up to 5 seconds.
            /varset miscTimer 50
            /squelch /doortarget
            /squelch /face fast door
            /squelch /look -75
            :keypress
            | -Shifts look angle up and down while attempting to click.
            /look ${If[${Me.Look} < 120,${Math.Calc[${Me.Look} + 5]},-75]}
            /if (${Target.ID}) /squelch /target clear
            /keypress U
            /delay 2
            | -Check if I have zoned, or moved.
            /if (${Zone.ID} == ${currentZone} && ${Math.Distance[${locToStart}]} < 50) {
              | -Check keypressTimer.
              /if (${miscTimer}) {
                /goto :keypress
              } else {
                | -Check the retryTimer.
                /if (${retryTimer}) {
                  /if (${Debug} || ${Debug_Basics}) /echo |- EVENT_clickIt -| Click attempt failed, retrying.
                  /keypress back hold
                  /delay 2
                  /keypress forward
                  /delay ${Math.Rand[30]}
                  /if (${retryTimer}) /goto :retryClick
                  | -If the retryTimer has expired, and I have not clicked the object.
                } else {
                  /docommand ${ChatToggle} I have failed to click the object.
                }
              }
            }
          }
        }
      }
      /if (${Debug} || ${Debug_Basics}) /echo <== EVENT_clickIt -|
    /RETURN
    doors.ini
    Code:
    [stillmoona]
    stillmoona#1=7,-52.25,-147.75,-28.5,ET_DOOR01
    - delete this


    I dont know how to populate doors.ini with proper values if anyone has any insight that would be nice
     
    Last edited: Sep 27, 2023
  2. cream

    cream GM Staff Member

    Messages:
    239
    new door file in github, this should no longer be needed
     
  3. Casai

    Casai Orc Legionnaire

    Messages:
    109
    thank you