help with $target(light)

A forum for the general posts relating to MacroQuest. *DEPRECATED: This forum is no longer in public use, but remains here for your reading pleasure. Enjoy

Moderator: MacroQuest Developers

DF19
orc pawn
orc pawn
Posts: 17
Joined: Mon Apr 07, 2003 11:48 pm

help with $target(light)

Post by DF19 » Wed Jun 04, 2003 5:46 pm

what does /echo $target(light) show? it gives me wierd messages that i cant understand, like NONE and a couple more.

does this only work with PC's, NPC's, or what? and what does it do?

thanks for the help.

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Wed Jun 04, 2003 6:03 pm

Well, first of all, I have to tell you that the function is rather old and is probably out-of-date. However, what it does is return for you a string based upon the BYTE pointed to in the SPAWNINFO structure.

Code: Select all

						// $target(light)
						} else if (!strncmp("target(light)",szVar,13)) {
							i+=12;
							if (!pTarget) {
								strcat(szOutput,"NONE");
								j+=7;
							} else {
								PCHAR szLight = GetLightForSpawn(pTarget);
								strcat(szOutput,szLight);
								j+=strlen(szLight);
							}
Essentually, that block of code says: If 'target' doesn't exist, return "NONE", otherwise use the function 'GetLightForSpawn' to return to the client the string that it wants'.

So...we go to:

Code: Select all

PCHAR GetLightForSpawn(PSPAWNINFO pSpawn)
{
	BYTE Light = pSpawn->Light;
	if (Light>LIGHT_COUNT) Light=0;
	return szLights[Light];
}
Here, this function essentually says: 'Light' equals the target's numerical light number. If this number is greater than the number of light types that WE KNOW ABOUT, then simply make it equal to zero. Otherwise, use the szLights array to determine what 'kind' of light refers to which number was found.

As of the date when this function was last updated, we knew about the following light types:

Code: Select all

PCHAR szLights[] = {
    "NONE",    // 0  - No light 
    "CDL", // 1  - Candle 
    "TR",  // 2  - Torch 
    "TGS", // 3  - Tiny Glowing Skull 
    "SL",  // 4  - Small Lantern 
    "SoM", // 5  - Stein of Moggok 
    "LL",  // 6  - Large Lantern 
    "FL",  // 7  - Flameless lantern, Halo of Light 
    "GOS", // 8  - Globe of stars 
    "LG",  // 9  - Light Globe
    "LS",  // 10 - Lightstone, Burnt-out lightstone, wispstone 
    "GLS", // 11 - Greater lightstone 
    "FBE", // 12 - Fire Beatle Eye, Firefly Globe
    "CL"  // 13 - Coldlight 
};

Now, of course all of this assumes that the "Light" is correctly placed in the SPAWNINFO structure. One can also assume that there are probably light types that go higher than 13 :). So, the first thing we'd want to do to update it would be to put on something simple like a "Greater Lightstone", make sure that it returns "11", then we know our struct is correct. ...then, we start testing out other light sources.

Of course, SOE has also made this rather complex by putting light values on various equipment types other than just what we would consider traditional "light sources". WHICH, is probably why this function is out-of-date and of little interest to most MQ users.

Zxeses
a ghoul
a ghoul
Posts: 103
Joined: Tue Jan 07, 2003 4:17 pm

err

Post by Zxeses » Wed Jun 04, 2003 6:15 pm

I hate to contradict such a great post however the light routine is a major cool feature.

For many classes, you need Greater lightstones to complete early level quests. Armor quests mostly, but for my wizard I needed GLS's for a certain book as well. The lightstone routine takes a bunch of wasted time out of killing hundreds of wisps.

I last used the feature in early feb (2003), and it worked then (if that helps at all)

-Z

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Wed Jun 04, 2003 7:02 pm

This is a good point ...also one of the shawl quests involves a glowing bile in GD that I once tried to figure out the light # for and wasn't very lucky with it :)

DF19
orc pawn
orc pawn
Posts: 17
Joined: Mon Apr 07, 2003 11:48 pm

Post by DF19 » Wed Jun 04, 2003 10:13 pm

Amadeus wrote:This is a good point ...also one of the shawl quests involves a glowing bile in GD that I once tried to figure out the light # for and wasn't very lucky with it :)
:twisted:

thanks for the help, the list you gave was exactly what i was getting. i just had no idea what things like FL and CDL were.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Thu Jun 05, 2003 8:53 am

Oh sure, now you tell me. You know how many of those wurms I slaughtered helping my wife collect the glowing bile?
MQ2: Think of it as Evolution in action.

Wishbringer
Contributing Member
Contributing Member
Posts: 230
Joined: Thu Nov 14, 2002 7:00 am

Post by Wishbringer » Thu Jun 05, 2003 9:53 am

There was months ago a thread for a light.mac to farm glowing worm biles...
And it worked! Tailored three shawls for my twinks.
Don't know if function is still ok.

http://macroquest2.com/phpBB2/viewtopic.php?t=1555

but not with $target(light), we used $spawn(id,light).

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

Hrm.

Post by Glasscoin » Sat Jun 07, 2003 8:10 pm

Anyone else have this problem?
/echo $target(light) will return NONE, no matter what. Even if I have a GLS equipped, no dice. Still returns NONE. Any suggestions? (Yes, I have dynamic lighting on.)

DF19
orc pawn
orc pawn
Posts: 17
Joined: Mon Apr 07, 2003 11:48 pm

Re: Hrm.

Post by DF19 » Sat Jun 07, 2003 8:25 pm

Glasscoin wrote:Anyone else have this problem?
/echo $target(light) will return NONE, no matter what. Even if I have a GLS equipped, no dice. Still returns NONE. Any suggestions? (Yes, I have dynamic lighting on.)
it always shows none on yourself, but if another character has something, it will show it.

also, im not sure if NPCs show thier light anymore, im going to check it out on wisps in a few minutes.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

bile macro

Post by grimjack » Sat Jun 07, 2003 8:32 pm

I had a macro from here for biles. I will test it again and see if it works still. It's been like 2 months since I used it. It shows all the mobs in a zone with lightsources. I'm not sure who the original creator was but I'll post it if it still works.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Lightsources

Post by grimjack » Sat Jun 07, 2003 8:42 pm

This will show all the lightsources in the zone on mobs or chars. I did not create this but I can't remember who did. I used it for finding wurms with lightsources(bile).

Edit:
code is by lifewolf

Code: Select all

#turbo 72 

Sub Main 
   /varset l0 $id(0) 
   /varset l1 0 
   /varset l2 0 
   /echo Scanning all zone spawns for light, please wait ... 
   :Loop 
      /varadd l1 1 
      /if "$spawn($l0,light)"!="NONE" { 
         /echo  Light:  [$l0]  [$spawn($l0,light)] $spawn($l0,name) 
         /varadd l2 1 
      } else { 
|        /echo  NoLight:  [$l0]  [$spawn($l0,light)] $spawn($l0,name) 
      } 
      /varset l0 $spawn($l0,next) 
      /delay 0 
   /if $l0>0 /goto :Loop 

   /echo Scanned $int($l1) spawns, $int($l2) had lightsources and $int($calc($l1-$l2)) did not. 
/return 
Last edited by grimjack on Sat Jun 07, 2003 10:34 pm, edited 1 time in total.

Glasscoin
a lesser mummy
a lesser mummy
Posts: 55
Joined: Mon Jan 13, 2003 8:57 am

Post by Glasscoin » Sat Jun 07, 2003 9:06 pm

Hmmm, tried it out today, on wisps, and it appears that $target(light) or $spawn(id,light) will return light sources for PC's, but not NPC's.

Is it just me? Anyone who has also tested, lemme know!

DF19
orc pawn
orc pawn
Posts: 17
Joined: Mon Apr 07, 2003 11:48 pm

Post by DF19 » Sat Jun 07, 2003 10:21 pm

grim: http://macroquest2.com/phpBB2/viewtopic.php?t=1555

it appears lifewolf wrote this, unless he originally got it from someone else.

this is what i tested, and where i noticed only PC's and corpses having lightsources showing. i still need to check out a zone with wisps, gotta get off my lazy arse...

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Tranquility

Post by grimjack » Sat Jun 07, 2003 10:35 pm

I thought I saw mobs in pot with lightsources.

DF19
orc pawn
orc pawn
Posts: 17
Joined: Mon Apr 07, 2003 11:48 pm

Post by DF19 » Sat Jun 07, 2003 11:27 pm

i just went to Gfay, did a /who wisp, there were two. ran the macro, only players and corpses showed up. targeted one, said lightsource was "NONE".

wisps always have light, even if it is just burned out.

the light command is broken for NPC's, guess ill have to do the 5th shawl the old fashioned way :\