Spawnchecker with INI support

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

lestor
orc pawn
orc pawn
Posts: 16
Joined: Sat Jan 10, 2004 6:31 am

Spawnchecker with INI support

Post by lestor » Fri Feb 06, 2004 11:57 am

Checks the zone for spawn names listed in the INI. Will perform a system beep when a mob spawns. The INI file is divided into sections by zone name. When you zone the macro will load the list for your zone, and check for any spawns on the list. When a mob spawns, the macro logs it's spawn time and location to the log file.

2/26/04: I don't really remember what I updated, but it works better.

checkspawns.mac

Code: Select all

| - CheckSpawns macro by Lestor
|
|  Commands:
|    /echo help                + Diplays commands.
|    /echo add <spawnname>     + Adds a spawn name to the list in the INI file.
|    /echo beep [ONCE/ON/OFF]  + Turns beeping on or off.  Or only beep once.
|    /echo log [ON/OFF]        + Turns logging on or off.
|    /echo reload              + Reloads the INI file.


#turbo

#define INIFILE spawns.ini

#event HelpCommand "[MQ2] help"
#event AddCommand "[MQ2] add"
#event BeepCommand "[MQ2] beep"
#event LogCommand "[MQ2] log"
#event ReloadCommand "[MQ2] reload"

Sub Main
	/declare zone global
	/declare spawn global
	/declare count1 global
	/declare count2 global
	/declare delay global
	/declare spawnlist array

	/varset zone 0
	/varset spawn 0

	/echo SpawnChecker v1.0 loaded.
	/echo Use '/echo help' for a list of commands.

	/if "@zone"!="$zone()" {
		/call GetINIList
		/echo Loading spawn list for $zone()...
		}

	:Loop
		/doevents
		/if "@zone"!="$zone()" {
			/call GetINIList
			/echo Loading spawn list for $zone()...
			}
		/if "$ini(INIFILE,"@zone",Spawn$int(@spawn))"==NOTFOUND /varset spawn 0
		/if n $searchspawn("$ini(INIFILE,"@zone",Spawn$int(@spawn))")==0 /if "@spawnlist($int(@spawn))"!="NULL" /if "@spawnlist($int(@spawn))"!="UNDEFINED-ARRAY-ELEMENT"  /call ReportTime "DESPAWNED" "@id"
		/if n $searchspawn("$ini(INIFILE,"@zone",Spawn$int(@spawn))")>0 /call Alarm $searchspawn("$ini(INIFILE,"@zone",Spawn$int(@spawn))")
		/varadd spawn 1
		/doevents
		/goto :Loop
/return

Sub Alarm(id)
	/call ReportTime "SPAWNED" "@id"

	/doevents

	/if $ini(INIFILE,Settings,Beep)==ON /beep
	/if $ini(INIFILE,Settings,Beep)==OFF /return

	/if $return==ADDED {
		/delay 5
		/return
		}

	/if $ini(INIFILE,Settings,Beep)==ONCE /return

	/varset count1 0
	/if n @delay>1 /varsub delay 1
	:Delay
		/if "@spawnlist($int(@count1))"==UNDEFINED-ARRAY-ELEMENT /return
		/if "@spawnlist($int(@count1))"==0 /delay @delay
		/doevents
		/varadd count1 1
		/goto :Delay
/return

Sub ReportTime(action,id)
	/if "@spawnlist($int(@spawn))"!="NULL" /goto :Despawned
	/if @action==SPAWNED {
		/varset delay 20
		/if $ini(INIFILE,Settings,Beep)==ONCE /beep
		/echo [$if(n,$time(h)>12,$int($calc($time(h)-12)),$time(h)):$if(n,$time(m)<10,0$time(m),$time(m))$if(n,$time(h)>12,pm,am)] $spawn(@id,name,clean) is up!  ($int($spawn(@id,y)), $int($spawn(@id,x)), $int($spawn(@id,z)))
		/if $ini(INIFILE,Settings,Log)==ON /mqlog [$if(n,$time(h)>12,$int($calc($time(h)-12)),$time(h)):$if(n,$time(m)<10,0$time(m),$time(m))$if(n,$time(h)>12,pm,am)] $spawn(@id,name,clean) spawned at: ($int($spawn(@id,y)), $int($spawn(@id,x)), $int($spawn(@id,z)))
		/varset spawnlist($int(@spawn)) "$spawn(@id,name,clean)"
		}
	/return ADDED
	:Despawned
	/if @action==DESPAWNED {
		/varset delay 20
		/echo [$if(n,$time(h)>12,$int($calc($time(h)-12)),$time(h)):$if(n,$time(m)<10,0$time(m),$time(m))$if(n,$time(h)>12,pm,am)] @spawnlist($int(@spawn)) despawned.
		/if $ini(INIFILE,Settings,Log)==ON /mqlog [$if(n,$time(h)>12,$int($calc($time(h)-12)),$time(h)):$if(n,$time(m)<10,0$time(m),$time(m))$if(n,$time(h)>12,pm,am)] @spawnlist($int(@spawn)) despawned.
		/varset spawnlist($int(@spawn)) NULL
		}
/return

sub GetINIList
	/varset zone "$zone()"
	/varset spawn 0
	:Loop
		/if "$ini(INIFILE,"@zone",Spawn$int(@spawn))"==NOTFOUND /return
		/varset spawnlist($int(@spawn)) NULL
		/varadd spawn 1
		/goto :Loop
/return

sub AddSpawn(spawnname)
	/varset count2 0
	:Loop
		/doevents
		/if "$ini(INIFILE,"@zone",Spawn$int(@count2))"==NOTFOUND /goto :Add
		/varadd count2 1
		/goto :Loop
	:Add
		/ini "INIFILE" "@zone" "Spawn$int(@count2)" "@spawnname"
		/echo '@spawnname' added to INI file.
		/call GetINIList
/return

Sub Event_HelpCommand
	/echo - /echo add <spawnname>
	/echo - /echo beep [ONCE/ON/OFF]
	/echo - /echo log [ON/OFF]
	/echo - /echo reload
/return

Sub Event_AddCommand(text)
	/if "$right(3,@text)"==add {
		/echo You must specify a spawn name.
		/return
		}
	/call AddSpawn "$right($calc($strlen("@text")-10),"@text")
/return

Sub Event_LogCommand(text)
	/if "$right(3,"@text")"==log {
		/if $ini(INIFILE,Settings,Log)==OFF /goto :On
		/if $ini(INIFILE,Settings,Log)==ON /goto :Off
		}
	/if "$right(3,"@text")"==OFF /goto :Off
	/if "$right(2,"@text")"==ON /goto :On
	/echo Invalid command.
	/return

	:Off
		/ini "INIFILE" "Settings" "Log" "OFF"
		/echo Logging is now OFF.
		/return
	:On
		/ini "INIFILE" "Settings" "Log" "ON"
		/echo Logging is now ON.
/return

Sub Event_BeepCommand(text)
	/if "$right(4,"@text")"==beep {
		/if $ini(INIFILE,Settings,Beep)==OFF /goto :Once
		/if $ini(INIFILE,Settings,Beep)==ON /goto :Off
		/if $ini(INIFILE,Settings,Beep)==ONCE /goto :On
		}
	/if "$right(3,"@text")"==OFF /goto :Off
	/if "$right(2,"@text")"==ON /goto :On
	/if "$right(4,"@text")"==ONCE /goto :Once
	/echo Invalid command.
	/return

	:Once
		/ini "INIFILE" "Settings" "Beep" "ONCE"
		/echo Beep notification set to ONCE.
		/beep
		/return
	:On
		/ini "INIFILE" "Settings" "Beep" "ON"
		/echo Beep notification set to ON.
		/beep
		/return
	:Off
		/ini "INIFILE" "Settings" "Beep" "OFF"
		/echo Beep notification set to OFF.
/return

Sub Event_ReloadCommand(text)
	/echo Reloading INI file...
	/call GetINIList
/return
Also a sample INI file:

spawns.ini

Code: Select all

[Settings]
Beep=ONCE
Log=ON

[Iceclad Ocean]
Spawn0=Lodizal
Spawn1=Stormfeather

[Southern Karana]
Spawn0=Quillmane

[Lower Guk]
Spawn0=Raster of Guk

[Plane of Fear]
Spawn0=Cazic Thule
Spawn1=Dracoliche
Spawn2=Dread
Spawn3=Fright
Spawn4=Terror

Enjoy,

Lestor
Last edited by lestor on Thu Feb 26, 2004 12:44 pm, edited 2 times in total.

User avatar
Elric
Cheese Whore
Cheese Whore
Posts: 466
Joined: Sun Nov 23, 2003 12:31 am
Location: Tampa, Fl
Contact:

Post by Elric » Fri Feb 06, 2004 12:29 pm

That's nice.

By the way, instead of reposting to add something to it, next time just click edit, or post a reply in the other one. :-P
-Elric

lestor
orc pawn
orc pawn
Posts: 16
Joined: Sat Jan 10, 2004 6:31 am

Post by lestor » Sat Feb 07, 2004 4:04 am

It was a double post. My connection was pretty flakely when I tried to post it... I wasn't able to even view the forum until now. I'll edit the other one out, thanks.

-Lestor

wardave
a ghoul
a ghoul
Posts: 120
Joined: Sun Jan 25, 2004 4:38 am

Post by wardave » Sat Feb 07, 2004 4:15 am

Cool macro, now maybe some of us can quit using SEQ :)

User avatar
Infinite monkeys
a lesser mummy
a lesser mummy
Posts: 36
Joined: Tue Feb 24, 2004 11:14 pm

Post by Infinite monkeys » Tue Feb 24, 2004 11:24 pm

First off just wanted to say thanks to all those that have worked on MQ and the people posting their macros for us to learn from. I have managed to get MQ up and running on 2 computers and am now in the process for learning what I want to use it for and how to do it.

This macro will hopefully do one of things I would like but I can't seem to get it running. If I start it then it will say "loading spawn list for zone X" but will not report any spawns in the zones. I have the INI file in the same folder as the macro atm and if I add a name through the macro it will update the INI so that's working right. It also will not load from the INI when I zone. If someone could at least tell me if it's me and not the program that would be a start, any advice is appreciated.

Also I want an up to date spawn list with all named for all the higher end zones at least, once I get this up and working I will post what I have so far and if people would like to add whatever info they can to what I am missing I'll keep it undated. Unless the mods have an object at least, I was unable to find one that was very up to date so I thought I could at least contribute a little something.

Thanks

lestor
orc pawn
orc pawn
Posts: 16
Joined: Sat Jan 10, 2004 6:31 am

Post by lestor » Thu Feb 26, 2004 12:51 pm

I use this on a daily basis, nearly every minute of my playtime, and it works like a charm. It's great for places like Droga, and Veksar. :)

By the way, it's very easy to create a list of named for a zone. Just go to Allakhazam, and look up mobs by zone.. click on something that seems named, and see if it drops anything. If so.. add it.

In the future I plan to add priorities for each spawn. So that on some spawns it will beep once, and some spawns it will only echo a line to the MQ window. Then, other times it'll beep like crazy to wake your ass up because Stormfeather just spawned, and some little dickhead is going to steal it!

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Thu Feb 26, 2004 10:24 pm

I modified it to use the Speech Plugin to tell you the name of the mob when/if it spawns, works pretty damn well.
Opinions are like assholes, everyone has one, but most of them stink.

mekaniak
a hill giant
a hill giant
Posts: 290
Joined: Thu Sep 18, 2003 3:21 pm

Post by mekaniak » Fri Feb 27, 2004 7:32 pm

lol sounds like lester made this macro cuz some one stole stormfeather from him. :lol:
I love the Power Glove, it's so bad

Say hello to M.C. Smurf!

[quote]<mekaniak> adios guys.
<dont_know_at_all> idiot
* mekaniak is now known as mekaniak_dinner
<Jacensolo> me?
<dont_know_at_all> not this time
[/quote]

[quote]
<dont_know_at_all> A_Enchanter_00, how the fuck should i know? it's your code[/quote]

I love quoting IRC chat.

HaCK
orc pawn
orc pawn
Posts: 13
Joined: Fri Feb 13, 2004 10:16 pm

Post by HaCK » Sat Feb 28, 2004 10:40 am

Anyone who uses SEQ could grab the zone filter files and recreate them into your INI file. It's a really good list of rare mobs.

lestor
orc pawn
orc pawn
Posts: 16
Joined: Sat Jan 10, 2004 6:31 am

Post by lestor » Sat Feb 28, 2004 12:02 pm

Actually, I made it to camp Lodizal, then decided it would be useful for other things, so I made it read from an INI. Then I expanded it, and kept adding to the spawn list.. now I have named/important mobs in there for probably 50 different zones. It's very handy to be able to walk into a zone and immediately have a readout of all the named mobs up. Sometimes my computer beeps before I even finish zoning in!

Cheers,

Les

theafkxper
a hill giant
a hill giant
Posts: 207
Joined: Sun Sep 08, 2002 6:41 pm

Post by theafkxper » Sun Feb 29, 2004 2:54 am

Suggestion/Improvement;
Let it accept another line in the inifile (iSpawn1="...", or similar) that we can put information about the mob in, and would also show up when the mob spawned, if that setting was turned on. There was another spawn checker that had this, but it seems to be broken, I very much enjoyed this feature b/c you could link the items it drops or provide relitive mob info without using allakhazam.

Thanks
/afk

Goofmester1
a hill giant
a hill giant
Posts: 241
Joined: Thu Nov 06, 2003 4:26 am

Post by Goofmester1 » Sun Feb 29, 2004 5:46 am

Anyway to make it to were the entire name has to match? I added one mob and the zone it is in there are alot of mobs that use that name as part of it. I get a return for only the nearest one of those and not the mob I am actually after.

lestor
orc pawn
orc pawn
Posts: 16
Joined: Sat Jan 10, 2004 6:31 am

Post by lestor » Sun Feb 29, 2004 10:32 pm

I had plans to expand this to allow spawn info in the INI file, such as drops, location, etc.. Just haven't gotten around to it. Also, I'm not exactly sure how links are formatted. And I remember reading somewhere that links displayed in the MQ chat window don't work. I know they don't work when you issue a /banklist command. If you want to, go right on ahead and add the spawn info functionality.. If not.. I'll do it when I get around to it.

Les

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Mob Descriptions

Post by GD » Sun Feb 29, 2004 11:56 pm

In the ReportTime Subroutine, add the following code in red:

Code: Select all

/echo [$if(n,$time(h)>12,$int($calc($time(h)-12)),$time(h)):$if(n,$time(m)<10,0$time(m),$time(m))$if(n,$time(h)>12,pm,am)] $spawn(@id,name,clean) is up!  ($int($spawn(@id,y)), $int($spawn(@id,x)), $int($spawn(@id,z)))
[color=red]/if "$ini(INIFILE,"@zone",Desc$int(@spawnnum))"!="NOTFOUND" /echo Desc: $ini(INIFILE,"@zone",Desc$int(@spawnnum))[/color]
and:

Code: Select all

/mqlog [$if(n,$time(h)>12,$int($calc($time(h)-12)),$time(h)):$if(n,$time(m)<10,0$time(m),$time(m))$if(n,$time(h)>12,pm,am)] $spawn(@id,name,clean) spawned at: ($int($spawn(@id,y)), $int($spawn(@id,x)), $int($spawn(@id,z)))
[color=red]/if "$ini(INIFILE,"@zone",Desc$int(@spawnnum))"!="NOTFOUND" /mqlog Desc: $ini(INIFILE,"@zone",Desc$int(@spawnnum))[/color]
Then, to add descriptions, add a Desc value to the INI like so:

Code: Select all

[Torden, The Bastion of Thunder]
Spawn1=Oreen Wavecrasher
Desc1=Can drop Belt of Thunderous Auras (ft2 belt), rune, ornate, plus more!
Opinions are like assholes, everyone has one, but most of them stink.