Get related: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
Problem with the return type...
 
imported>Bale
No edit summary
Line 19: Line 19:
code=
code=
<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
foreach thing in get_related($item[black pepper], "zap")
if(item_amount($item[black pepper]) == 0)
  if(item_amount(thing)> 0) {
  foreach thing in get_related($item[black pepper], "zap")
      cli_execute("zap "+thing);
      if(item_amount(thing)> 0) {
      break;
        cli_execute("zap "+thing);
  }
        break;
      }


</syntaxhighlight>}} |
</syntaxhighlight>}} |
|
|
}}
}}

Revision as of 01:16, 26 February 2010

Function Syntax

Retrieves some variable-length internal data that isn't readily readable via file_to_map().

Code Sample

If you need back pepper, this will try to zap something into it.

if(item_amount($item[black pepper]) == 0)
   foreach thing in get_related($item[black pepper], "zap")
      if(item_amount(thing)> 0) {
         cli_execute("zap "+thing);
         break;
      }