isaffected checks

For builders to discuss and ask building questions.
Post Reply
User avatar
Duranamir
Sword Grand Master
Sword Grand Master
Posts: 740
Joined: Thu Nov 27, 2003 11:58 am
Location: Skull port

isaffected checks

Post by Duranamir » Tue Mar 24, 2009 2:31 pm

I want to check the players for having certain spells cast on themselves. From reading the builders help the best bet seems to be

"if isaffected($n) == XXXX"

I can not get this to work currently as it complains that it is checking for an unkown affect, what i think i need is the correct syntax for the right hand side...

Specific spells i am after currently are "True sight" and "invis".

Duranamir
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: isaffected checks

Post by Harroghty » Wed Mar 25, 2009 12:45 am

Have you tried this?
== 'true sight'
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
User avatar
Duranamir
Sword Grand Master
Sword Grand Master
Posts: 740
Joined: Thu Nov 27, 2003 11:58 am
Location: Skull port

Re: isaffected checks

Post by Duranamir » Wed Mar 25, 2009 9:34 pm

Actual syntax below.

if isaffected($n) == 'invisibility'

But still complains.

Duranamir
User avatar
Caelnai
Sword Grand Master
Sword Grand Master
Posts: 273
Joined: Sat Feb 12, 2005 6:03 pm
Location: Behind that tree...

Re: isaffected checks

Post by Caelnai » Wed Mar 25, 2009 9:53 pm

wouldn't that be 'invis' ?
User avatar
Duranamir
Sword Grand Master
Sword Grand Master
Posts: 740
Joined: Thu Nov 27, 2003 11:58 am
Location: Skull port

Re: isaffected checks

Post by Duranamir » Wed Mar 25, 2009 10:07 pm

Nope, below does not work either.


if isaffected($n) == 'invis'
Enig
Sword Grand Master
Sword Grand Master
Posts: 787
Joined: Wed Dec 20, 2006 5:28 pm
Location: The Frozen North (Canada!)

Re: isaffected checks

Post by Enig » Wed Mar 25, 2009 10:18 pm

It's sort of strange, but I think it ought to work if you try...

if isaffected($n)= invisible

I'm not sure about the true sight, but I'll give a whirl later on with some trial and error.
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Re: isaffected checks

Post by Dalvyn » Thu Mar 26, 2009 8:12 am

What you could try to do is this:

Get a hold of an imm online, cast the required spell, and ask the imm to "mstat" you. The imm should see a line saying "Affected: ..." followed by a series of names. Try using that name.

I would guess that it is

isaffected($n) == invis

isaffected($n) == true_sight

but I'm not 100% sure.

(The whole check is actually nonsensical in its form ... it should be something like "isaffected($n,invis)" instead of using ==)
Image
User avatar
Duranamir
Sword Grand Master
Sword Grand Master
Posts: 740
Joined: Thu Nov 27, 2003 11:58 am
Location: Skull port

Re: isaffected checks

Post by Duranamir » Thu Mar 26, 2009 9:11 am

Dalvyn, thanks for the help. Points up an error in the help files as they say..
isaffected checks if $whatever is affected by rhs
if isaffected($n) == Detect_magic
Duranamir
User avatar
Duranamir
Sword Grand Master
Sword Grand Master
Posts: 740
Joined: Thu Nov 27, 2003 11:58 am
Location: Skull port

Re: isaffected checks

Post by Duranamir » Thu Mar 26, 2009 10:11 pm

Thanks to everyone for there help. Got it working now. If anyone is interested syntax was correct as per lesson. Values needed were the words invisible and true_sight.

Duranamir
User avatar
Lathlain
Sword Grand Master
Sword Grand Master
Posts: 1169
Joined: Sun Aug 10, 2003 4:25 pm
Location: Zhentil Keep

Re: isaffected checks

Post by Lathlain » Thu Mar 26, 2009 10:35 pm

No problem mate - glad we could set you right!
"This is General Lath'lain Dy'nesir, of the Ebon Spur. Walking Murder surrounded by a thin veneer of civility."
-Miriel
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Re: isaffected checks

Post by Dalvyn » Fri Mar 27, 2009 10:47 am

Duranamir wrote: If anyone is interested syntax was correct as per lesson.
Ah, I wasn't suggesting that you should use "isaffected($n, invisible)", just pointing out that the current form (which is the one that works) does not make sense.

What does not make sense in it is that something written as "isaffected($n)" should have a unique value.

For example, "inroom($n)" is the vnum of the room where $n is ... and thus writing "inroom($n) == 8030" makes sense: it checks that this value IS 8030.

But "isaffected($n)" does not have a single value, and "isaffected($n) == invisible" and "isaffected($n) == true_sight" can both be true at the same time, which ... just does not make sense because something cannot be equal to both "invisible" and "true_sight". But yes, that's the ay it is, currently.
Image
User avatar
Harroghty
Staff
Staff
Posts: 9695
Joined: Tue Jul 27, 2004 5:38 pm

Re: isaffected checks

Post by Harroghty » Tue Oct 16, 2012 12:06 am

This is now if isaffected($n) == truesight
"A man may die yet still endure if his work enters the greater work, for time is carried upon a current of forgotten deeds, and events of great moment are but the culmination of a single carefully placed thought." - Chime of Eons
Post Reply