Talk:Use familiar

From Kolmafia
Revision as of 18:42, 25 September 2010 by imported>StDoodle
Jump to navigation Jump to search

This always seems to return false for me, can anyone confirm?
--Slyz 20:56, 9 April 2010 (UTC)


> ash use_familiar($familiar[sandworm])
Putting Mexicana the Hovering Sombrero back into terrarium...
Taking Hecho en Mexico the Baby Sandworm out of terrarium...
Returned: true

I assume that the ash command should be enough to check return value; correct me if I'm wrong. --Heeheehee 21:03, 9 April 2010 (UTC)

I'll have to recheck after RO, but here is what I was getting (doing things slightly differently):

> ash print( use_familiar($familiar[slimeling]) )
Putting Dusty the Baby Sandworm back into terrarium...
Taking Yuk the Slimeling out of terrarium...
false
Returned: void

--Slyz 03:33, 10 April 2010 (UTC)


Huh. Using that method, I get:

> ash print( use_familiar($familiar[sombrero]) )
Putting Hecho en Mexico the Baby Sandworm back into terrarium...
Taking Mexicana the Hovering Sombrero out of terrarium...
true
Returned: void

--Heeheehee 07:51, 10 April 2010 (UTC)

I'm also seeing expected behavior; true most of the time, false if I try a familiar I don't have. --StDoodle (#1059825) 14:52, 10 April 2010 (UTC)


I find the syntax as described on this page confusing. With other functions I do not have to specify the datatype, for example:
outfit($string[Backup]);
outfit("Backup");
both work identically. However, use_familiar("hobo");
returns the error "Function 'use_familiar( string )' undefined..."
This just happened to be the first function I looked up on this wiki, and if the discussion with examples had not been here, I don't think I would have worked it out at all.--RogerMexico 12:04, 25 September 2010 (UTC)

By default, supplying something inside of quotes is considered of the "string" datatype. So, $string[hello] is the same as "hello". However, use_familiar() needs the familiar datatype. You can't just supply a string (ie "hobo"); you need to supply a familiar. Since datatypes like familiar, element, etc. aren't "normal" datatypes used in programming, we have to use an explicit datatype constant call (the dollar-sign thing) or a function that converts from a string to that datatype. --StDoodle (#1059825) 18:42, 25 September 2010 (UTC)