Path Maker and Tester with GUI

Moderator: MacroQuest Developers

selu989
orc pawn
orc pawn
Posts: 18
Joined: Wed Sep 15, 2004 1:55 pm

Path Maker and Tester with GUI

Post by selu989 » Tue Mar 21, 2006 7:15 pm

Made this today to make a node list for the zones Im hunting/Farming/TS in.

For those that havent seen the ISX solution to pathfiles this should be something to envy :roll:

It works some thing like this..

You add a node (x,y,z) with a unique name and connect it to another named node, you keep doing this until you have the whole zone covered in a spiderweb of paths and named nodes (ie banker1,vendor, smith etc) then when you wish to go somewhere you simply ask innerspace nicely

NavPath zone banker1 vendor

and innerspace hands you the shortest path from banker1 to vendor in a array containing the connected nodes.

Having a xml with all the quest npc's / tradeskill containers / bankers / vendors makes the task of moving and doing multiple tradeskills way easy.

this code should be considered alpha atm Ill rework it in the morning if someone actually downloads it ;)

*Edit*
Added SelectNearestPoint and Move/Rename
Fixed Saving of maps and *lots* of bugs.
Added point update when zoning(no need to reload after zoning)

test.iss in your Scripts folder

Code: Select all

; test.iss (filename DOES matter)

Function main()
{
	declare World string global "${Zone.Name}"
	declare LastPoint string global
	declare SelectedPoint string global
	Navigation -reset
	Navigation -load "Scripts/eq/test/${World}.xml"
	ui -load "Scripts/eq/test/test_ui.xml"
	AddTrigger Zoned "You have entered @*@."
	
	call UpdatePointList
	do
		{
			ExecuteQueued
			waitframe
		}
		while 1
		
}


function atexit()
{
	
	keypress forward
	ui -unload "Scripts/eq/test/test_ui.xml"
	
}

function AddPoint()
{
	if (${Navigation.World["${World}"].LastID}<1) 
		{
			NavPoint -set "${World}" Path_1 ${Me.X} ${Me.Y} ${Me.Z}
			LastPoint:Set["${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"]
			UIElement[TestListBox@Movement@Test Path tabbs@Test Path]:AddItem["${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"]
		}
	else
		{
			NavPoint -set "${World}" Path_${Math.Calc[${Navigation.World["${World}"].LastID}+1].Int} ${Me.X} ${Me.Y} ${Me.Z}
			NavPoint -connect -bidirectional "${World}" "${LastPoint}" "${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"
			LastPoint:Set["${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"]
			UIElement[TestListBox@Movement@Test Path tabbs@Test Path]:AddItem["${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"]
		}	
}

function AddNamedPoint()
{
	InputBox "Enter the name of this point"
	
	if (${Navigation.World["${World}"].LastID}<1) 
		{
			NavPoint -set "${World}" "${UserInput}" ${Me.X} ${Me.Y} ${Me.Z}
			UIElement[TestListBox@Movement@Test Path tabbs@Test Path]:AddItem["${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"]
		}
	else
		{
			NavPoint -set "${World}" "${UserInput}" ${Me.X} ${Me.Y} ${Me.Z}
			NavPoint -connect -bidirectional "${World}" "${LastPoint}" "${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"
			LastPoint:Set["${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"]
			UIElement[TestListBox@Movement@Test Path tabbs@Test Path]:AddItem["${Navigation.World["${World}"].Point[${Navigation.World["${World}"].LastID}].Name}"]
		}	
}

function FindNearestPoint()
{
	messagebox -yesno "Set this as lastpoint? Name:${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]} Dist:${Math.Distance[${Me.X},${Me.Y},${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}].X},${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}].Y}]}"
	if ${UserInput.Equal["Yes"]} 
		{
			LastPoint:Set["${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]}"]
			echo "${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]} set as lastpoint."
		}
	return
}

function ConnectNearestPoint()
{
	messagebox -yesno "Connect the lastpoint,${LastPoint} to ${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]}?" 
	if ${UserInput.Equal["Yes"]}
		{
			navpoint -connect -bidirectional "${World}" "${LastPoint}" "${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]}"
			echo "${LastPoint} is now connected to ${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]}" 
		}
}

function SaveMap()
	{
		Navigation.World["${World}"]:Export["${Script.CurrentDirectory}/eq/test/${World}.xml"]
		
		
	}
	
function MovePoint()
	{
		messagebox -yesno "Do you wish to move ${SelectedPoint} to your coords a move of ${Math.Calc[${Me.X},${Me.Y},${Navigation.World["${World}"].Point[${SelectedPoint}].X},${Navigation.World["${World}"].Point[${SelectedPoint}].Y}]} units?" 
		if ${UserInput.Equal["Yes"]}
			{
				Navigation.World[${World}].Point["${SelectedPoint}"]:SetPosition[${Me.X},${Me.Y},${Me.Z}]
			}
			
	}
	
function RenamePoint()
{
	InputBox "New Name?" "${SelectedPoint}"
	Navigation.World["${World}"].Point["${SelectedPoint}"]:Rename["${UserInput}"]
	call UpdatePointList
	SelectedPoint:Set["${UserInput}"]
}

function GotoPoint(string EndPoint)
{
	
	
		
		NavPath -reset
		NavPath "${World}" "${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]}" "${EndPoint}"
		
	if ${NavPath.Points}>0
		{
			declare PathIndex int local 1
			do
				{
					do
						{
							
							face nolook fast loc ${NavPath.Point[${PathIndex}].Y},${NavPath.Point[${PathIndex}].X}
							waitframe
							keypress forward hold
										
						}
					while ${Math.Distance[${Me.X},${Me.Y},${NavPath.Point[${PathIndex}].X},${NavPath.Point[${PathIndex}].Y}]}>6
					
					PathIndex:Inc
				}
			while ${PathIndex}<=${NavPath.Points}
			keypress forward
	}
	else 
		{
			popuptext "Invalid path"
			return
		}
		
	popuptext "Arrived"
	return
}

function UpdatePointList()
{
	
	UIElement[TestListBox@Movement@Test Path tabbs@Test Path]:ClearItems
	declare Count int local 0
	while (${Count:Inc} <= ${Navigation.World[${World}].Points})
	{
		UIElement[TestListBox@Movement@Test Path tabbs@Test Path]:AddItem[${Navigation.World[${World}].Point[${Count}].Name}]
	}
	
}

function Zoned(string FullLine)
{
  messagebox -yesno "Do you wish to save ${World} before loading the new Coords?"
  if ${UserInput.Equal["Yes"]}
  	{
  		call SaveMap
  	}
  World:Set["${Zone.Name}"]
  call UpdatePointList
} 

and test_ui.xml in Scripts/eq/test/

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ISUI>
   <Window name='Test Path'>
      <Visible>1</Visible>
      <X>300</X>
      <Y>200</Y>
      <Width>150</Width>
      <Height>250</Height>
      <Children>
			<TabControl name='Test Path tabbs' >
				<TabBorder>0</TabBorder>
				<TabHeight>12</TabHeight>
				<FrameBorder>10</FrameBorder>
				<X>0</X>
				<Y>0</Y>
				<Width>100%</Width> 
				<Height>100%</Height>
			
			<Tabs>
			<Tab name='Creation'>
         <commandbutton name='Add Point'>
            <X>10</X>
            <Y>5</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>Add Point</Text>
            <Command>Script[test]:QueueCommand[Call AddPoint]</Command>
         </commandbutton>
         
         <commandbutton name='Add Named Point'>
            <X>10</X>
            <Y>30</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>Add Named Point</Text>
            <Command>Script[test]:QueueCommand[Call AddNamedPoint]</Command>
         </commandbutton>
         
         <commandbutton name='Set last point'>
            <X>10</X>
            <Y>55</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>set last point</Text>
            <Command>Script[test]:QueueCommand[Call FindNearestPoint]</Command>
         </commandbutton>
         
         <commandbutton name='connect to nearest point'>
            <X>10</X>
            <Y>80</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>conn2nearest point</Text>
            <Command>Script[test]:QueueCommand[Call ConnectNearestPoint]</Command>
         </commandbutton>
         
         <commandbutton name='Select nearest point'>
            <X>10</X>
            <Y>105</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>Select nearest point</Text>
            <OnLeftClick>
							SelectedPoint:Set[${Navigation.World["${World}"].NearestPoint[${Me.X},${Me.Y},${Me.Z}]}]
							echo "${SelectedPoint} selected and it's ${Math.Calc[${Me.X},${Me.Y},${Navigation.World["${World}"].Point[${SelectedPoint}].X},${Navigation.World["${World}"].Point[${SelectedPoint}].Y}]} units away."
						</OnLeftClick>
         </commandbutton>
         
         <commandbutton name='Move selected point'>
            <X>10</X>
            <Y>130</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>Move selected point</Text>
            <Command>Script[test]:QueueCommand[Call MovePoint]</Command>
         </commandbutton>
         
         <commandbutton name='Rename selected point'>
            <X>10</X>
            <Y>155</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>Rename selected point</Text>
            <Command>Script[test]:QueueCommand[Call RenamePoint]</Command>
         </commandbutton>
         
         <commandbutton name='Save'>
            <X>10</X>
            <Y>180</Y>
            <Width>130</Width>
            <Height>20</Height>
            <Text>Save Map</Text>
            <Command>Script[test]:QueueCommand[Call SaveMap]</Command>
         </commandbutton>
         </Tab>
         <Tab name='Movement'>
         
         <listbox name='TestListBox'>
					<X>5</X>
					<Y>5</Y>
					<Width>130</Width>
					<Height>210</Height>
					<SelectMultiple>1</SelectMultiple>
					<Sort>Text</Sort>
					<Texture filename='Listbox.png'/>
					<OnDoubleLeftClick>
						
						Script[test]:QueueCommand[call GotoPoint "${UIElement[TestListBox@Movement@Test Path tabbs@Test Path].SelectedItem}"]
						
					</OnDoubleLeftClick>
				</listbox>								
         
         </Tab>
         </Tabs>
				</TabControl>
      </Children>
   </Window>
</ISUI>

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

Post by Red-One » Thu Mar 23, 2006 10:33 am

You should be in IRC sir, that is all.

-Red

spudman
a lesser mummy
a lesser mummy
Posts: 50
Joined: Mon Dec 12, 2005 11:04 am

Post by spudman » Wed Jun 14, 2006 11:04 pm

Sorry to dig up an old thread, but with mq2 down I was spending some time checking out IS, etc. and came across this. I'm assuming the pathing is built into IS and this macro assists in building the pathing files? I have one macro that uses a somewhat elaborate scheme of pathing files based around about oh...93 or so advpath files. :smile:

If IS has built in path handling and I can just name points and generate a path automatically that would be plenty handy for this specific macro. This might be enough incentive to get off my ars and learn some lavishscript and IS. Just curious.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jun 15, 2006 7:08 am

Lax has been working on updating the navagation system for IS. I'm not sure of the current status, but the older version was still working.

Still, until the new zip comes out, you're not going to be able to do much, since the ISXEQ relies on the same data updates as MQ2.

In the meantime, you can try searching the ISMods wiki, or go to the IRC chat rooms and ask. Some one should be able to help you, if they're there.
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Thu Jun 15, 2006 10:50 am

ISMods wiki ONLY has information on third-party mods (e.g. non-Lavish Software).

The updated nav system is called LavishNav, and you can find its documentation on the Lavish Software wiki ( http:www.lavishsoft.com/wiki ). Just follow the LavishNav link ;)

The old nav system is indeed still enabled, but only because there's still some scripts that use it.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0