PDA

View Full Version : Checkgrouped



Danical
07-03-2008, 01:01 PM
>;e echo checkgrouped
--- Lich: exec1 active.

--- Lich: exec1 has finished.

Various other check<item> give me the above output.

Methais
07-03-2008, 01:03 PM
MORE SEX?!

Danical
07-03-2008, 01:03 PM
YOU KNOW IT SUGARTITS!

Shaelun
07-04-2008, 04:25 AM
Most -- actually, I think virtually all -- of the state-checks (e.g. checkgrouped) are designed so that they return either false or nil when the given circumstance is non-true. Otherwise, you wouldn't be able to do the quick-and-easy sorts of things Ruby is so helpful because of: for example, you'd have to do something like if checkgrouped == 0 then echo "you're not grouped" end instead of being able to say echo "you aren't grouped" if not checkgrouped or some such.

Keep in mind that in Ruby, any values other than nil and false evaluate as logically true, and will be treated as such by any if or while or whatever other conditional statements you use.

So if you aren't in a group, checkgrouped is supposed to return nil, which when you try to echo gets printed out as literally nothing (since it is as close to absolutely no return value as Ruby gets) -- by default, "echo" will do nothing but print a newline (i.e. the "\n" character, the equivalent of a carriage return in a nutshell) if the parameter it receives is an empty string when converted for output.

More simply, you're passing the echo method a random object, and echo is asking that object to turn itself into a string -- nil, when turned into a string, is a 0-length (i.e. null, or empty) string. So echo skips printing the bracketed [scriptName: blah blah] and just outputs a newline.

You should try using the inspect method. Every object (literally every one) responds to it -- it converts the object into a string that represents the actual object's data, not necessarily the nicely-formatted-string version.

(run echo nil.inspect and you'll get a line consisting of [script: "nil"] for instance)

Hell of a verbose explanation, but that's the most detailed rundown I can give you. Is the behavior you're referring to making sense now? :)

Methais
07-04-2008, 04:58 PM
YOU KNOW IT SUGARTITS!

http://media.funlol.com/content/img/cybersex.jpg

Danical
07-06-2008, 03:43 PM
Most -- actually, I think virtually all -- of the state-checks (e.g. checkgrouped) are designed so that they return either false or nil when the given circumstance is non-true. Otherwise, you wouldn't be able to do the quick-and-easy sorts of things Ruby is so helpful because of: for example, you'd have to do something like if checkgrouped == 0 then echo "you're not grouped" end instead of being able to say echo "you aren't grouped" if not checkgrouped or some such.

Keep in mind that in Ruby, any values other than nil and false evaluate as logically true, and will be treated as such by any if or while or whatever other conditional statements you use.

So if you aren't in a group, checkgrouped is supposed to return nil, which when you try to echo gets printed out as literally nothing (since it is as close to absolutely no return value as Ruby gets) -- by default, "echo" will do nothing but print a newline (i.e. the "\n" character, the equivalent of a carriage return in a nutshell) if the parameter it receives is an empty string when converted for output.

More simply, you're passing the echo method a random object, and echo is asking that object to turn itself into a string -- nil, when turned into a string, is a 0-length (i.e. null, or empty) string. So echo skips printing the bracketed [scriptName: blah blah] and just outputs a newline.

You should try using the inspect method. Every object (literally every one) responds to it -- it converts the object into a string that represents the actual object's data, not necessarily the nicely-formatted-string version.

(run echo nil.inspect and you'll get a line consisting of [script: "nil"] for instance)

Hell of a verbose explanation, but that's the most detailed rundown I can give you. Is the behavior you're referring to making sense now? :)

That's all well and good except I was grouped. :(

Shaelun
07-07-2008, 02:19 AM
That's all well and good except I was grouped. :(

Ah. Then I need your version and front-end at the bare minimum; any other information that involves when the information is inaccurate would be helpful as well.

Fixing bugs is a matter of establishing a pattern, and without any information to narrow it down, it could be on any one of several thousand lines of code...

BigWorm
07-07-2008, 12:26 PM
I tested in the Wizard with the most recent Linux version (3.55 I'm pretty sure) and it works correctly when I am a member of a group but not if I am leading a group.

Shaelun
07-08-2008, 05:06 AM
I tested in the Wizard with the most recent Linux version (3.55 I'm pretty sure) and it works correctly when I am a member of a group but not if I am leading a group.


It occurs to me: does Wizard display the little "grouped" icon when you're leading the group, or only when you're a member of the group? That's how Lich tracks it -- so it's only as accurate as the info the game sends.

BigWorm
07-08-2008, 12:45 PM
No, it doesn't. I figured that might have something to do with it.