Difference between revisions of "Get related"
Jump to navigation
Jump to search
imported>Bale |
imported>Bale |
||
Line 27: | Line 27: | ||
</syntaxhighlight>}} | | </syntaxhighlight>}} | | ||
− | | | + | code2={{CodeSample | |
+ | title=Zap for stab bats! | | ||
+ | description=This will try to zap something into a tiny plastic stab bat so that you can send it to zarqon It returns true if successful. | | ||
+ | code= | ||
+ | <syntaxhighlight lang="c"> | ||
+ | boolean stab_zap() { | ||
+ | foreach doohicky in get_related($item[tiny plastic stab bat]) | ||
+ | if(item_amount(doohicky) > 0) { | ||
+ | cli_execute("zap "+doohicky); | ||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | </syntaxhighlight>}} | | ||
}} | }} |
Revision as of 03:35, 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;
}
Zap for stab bats!
This will try to zap something into a tiny plastic stab bat so that you can send it to zarqon It returns true if successful.
boolean stab_zap() {
foreach doohicky in get_related($item[tiny plastic stab bat])
if(item_amount(doohicky) > 0) {
cli_execute("zap "+doohicky);
return true;
}
return false;
}