• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - Can someone explain how this sub detects a door?

Joined
May 21, 2014
RedCents
994¢
Can someone explain how this sub detects a door? It is from Armysoldier's tradeskill macros. I've been searching here and MQ2 site to no avail, evidently my search skills stink, lol.



Rich (BB code):
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Movement Sub
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub Movement(Start,Finish,Door)
  /declare Location int inner

  /for Location ${Start} to ${Finish}
     :MoveLoop
     /face nolook loc ${LocArray[${Location}]}
     /if (${Math.Distance[${LocArray[${Location}]}]}>4) {
        /nomodkey /keypress forward hold
        /face nolook loc ${LocArray[${Location}]}

        /if (${Location}==${Door}) {
        /nomodkey /keypress u
        /nomodkey /keypress u
         }
     }
     /if (${Math.Distance[${LocArray[${Location}]}]}<=4) {
        /nomodkey /keypress forward
        /goto :next
     }
     /goto :MoveLoop
     :next
  /next Location
/return
 
so (without looking at the actual macro), when something calls sub movement, it passes 2 or 3 variables.

/call movement 1 5 4
/call movement 2 6 7

so it checks an array LocArray[1 2 3 4 5 6 7 8 9]

which is actually a 3 x something array looking like this:

1 2 3 4 5 6 7 8 9
100 101 123 543 567 987 123 345 789
321 456 789 123 432 453 567 657 678

So then it cycles between what is passed, say the first example:
/call movement 1 5 4

checks loc 1 to 5, in order:
1=100, 321
2=101, 456

etc. In the case of the third argument (4), if the location is location 4, and the door is also 4, then it knows to "use" the door.

In the second example: /call movement 2 6 7

the locations cycle from 2 to 6. because the "Door" coordinate is listed as 7, it never cycles to it, the steps never = 7, and it never assumes anything is a door, and thus never "uses" it.

make sense?
 
That helps me understand the sub itself, thank you very much. Now I need to figure out how Army's arrays are showing that, lol. Here is the mac I'm using to test the movement and door interaction, and my ini for NeriakC and Army's for Abysmal Sea in the pottery macro. It looks like I got some work to do to tune the ini to get it to open doors when it should, hehe.

Movement test macro:


Rich (BB code):
Sub Main
	/declare Filename outer NeriakC.ini
|	/declare SectionName string outer "Neriak"

|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Call Read INI for locations array
|                    
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /call ReadINIA ${Filename} NeriakC
    /if (!${Defined[LocArray]}) { 
       /echo No Loc Array Created...
       /endmacro 
    }
|	/call Movement 1 3
	/call Movement 20 22

/return

|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|Read INI file for Loc array
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub ReadINIA(FileName,SectionName) 
	/echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}... 
	/if (${Ini[${FileName},${SectionName}].Count[|]}==0) { 
		/echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro... 
		/return
	}
   } 
   /declare nValues     int local 
   /declare nArray      int local  0 

|~~~~~~~~~~~~~~~~~~~~~~ Locs ~~~~~~~~~~~~~~~~~
   /Varset nValues ${Ini[${FileName},${SectionName},Value]}
   /echo ${nValues} Locs
   :MakeArraylo 
   /if (!${nValues}) /return
   /if (${nValues}) { 
      /echo Declaring Loc Array... 
      /declare LocArray[${nValues}]  string outer
   }
   /for nArray 1 to ${nValues}
      /varset LocArray[${nArray}] ${Ini[${FileName},${SectionName},Loc${nArray}]}
      /echo  loc ${nArray} defined ${LocArray[${nArray}]}

   /next nArray



   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 

/return 


|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Movement Sub
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub Movement(Start,Finish,Door)
  /declare Location int inner

  /for Location ${Start} to ${Finish}
     :MoveLoop
     /face nolook loc ${LocArray[${Location}]}
     /if (${Math.Distance[${LocArray[${Location}]}]}>4) {
        /nomodkey /keypress forward hold
        /face nolook loc ${LocArray[${Location}]}

        /if (${Location}==${Door}) {
        /nomodkey /keypress u
        /nomodkey /keypress u
         }
     }
     /if (${Math.Distance[${LocArray[${Location}]}]}<=4) {
        /nomodkey /keypress forward
        /goto :next
     }
     /goto :MoveLoop
     :next
  /next Location
/return


NeriakC ini

Rich (BB code):
[NeriakC]
Value=22
Loc1=909.38,-1423.07
Loc2=882.60,-1468.82
Loc3=882.32,-1477.79
Loc4=798.05,-1478.04
Loc5=763.04,-1410.14
Loc6=765.02,-1345.24
Loc7=875.82,-1310.51
Loc8=876.69,-1280.22
Loc9=903.20,-1277.93
Loc10=901.88,-1273.85
Loc11=894.88,-1254.29
Loc12=901.64,-1264.67
Loc13=900.56,-1269.88
Loc14=899.05,-1279.26
Loc15=878.36,-1283.11
Loc16=874.11,-1311.38
Loc17=766.63,-1342.69
Loc18=761.80,-1408.14
Loc19=798.94,-1473.71
Loc20=884.34,-1479.36
Loc21=882.40,-1472.79
Loc22=903.40,-1425.41

Pottery ini:

Rich (BB code):
[Abysmal Sea]
Value=24
Loc1=110.96, 20.36
Loc2=178.05, 50.08
Loc3=178.05, 69.77
Loc4=92.04, 111.11
Loc5=92.67, 260.68
Loc6=-204.01, 261.08
Loc7=-225.75, 204.70
Loc8=-252.69, 202.40
Loc9=-225.75, 204.70
Loc10=-204.01, 261.08
Loc11=-254.69, 259.14
Loc12=-266.52, 258.82
Loc13=-329.85, 260.15
Loc14=-328.94, 241.51
Loc15=-329.85, 260.15
Loc16=-266.52, 258.82
Loc17=-254.69, 259.14
Loc18=-204.01, 261.08
Loc19=92.67, 260.68
Loc20=92.04, 111.11
Loc21=178.05, 69.77
Loc22=178.05, 50.08
Loc23=110.96, 20.36
Loc24=-259,193
 
Your macro is never accessing a door. So like his value is cycling from point 1 to ${Value}. in the case of the Pottery.ini that value is 24. So it starts at point 1 and goes through 2,3,4,5,67,......23,24

There is either missing code or he changed it to use auto doors (that was added in). Anyway, why not just change this:

Rich (BB code):
     /if (${Math.Distance[${LocArray[${Location}]}]}<=4) {
        /nomodkey /keypress forward
        /goto :next
     }
to:
Rich (BB code):
     /if (${Math.Distance[${LocArray[${Location}]}]}<=4) {
        /nomodkey /keypress forward
        /squelch /doortarget
        /if (${Switch.ID} && ${Switch.Distance}<=15) {
          /click left door
        }
        /goto :next
     }

Then it will just auto use any door you walk into.
 
I'll give that a run when things come back up this evening. Thanks a bunch Pete.

- - - Updated - - -

I think I figured out how this is supposed to work. The /call Movement needs a third loc on the call to find the door.

So this: /call Movement 1 3
Would need to be /call Movement 1 3 2 if the door was at loc 2.

The only problem is it only allows for one door on each call. So the macro I am working has two doors on each run would require two calls to accomplish. I like Pete's idea better, lol.

- - - Updated - - -

That works very well Pete, much easier than the other way.
 
Question - Can someone explain how this sub detects a door?

Users who are viewing this thread

Back
Top
Cart