Proxy Records: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
No edit summary
imported>Bale
No edit summary
Line 1: Line 1:
Proxy Records is a way for KoLmafia to pass additional information to the scripter. Many datatypes contain these proxy records such as items, skills, effects and coinmasters. This information is referred to as proxy records because the manner of their display is similar to the record datatype.
Proxy Records is a way for KoLmafia to pass additional information to the scripter. Many datatypes contain these proxy records. such as items, skills, effects and coinmasters. This information is referred to as proxy records because the manner of reference is similar to a field of a [[Data_Structures#Records|record]].


Here's an example of displaying proxy record information in the CLI
 
{{CodeSample|
description=This is an example of how to retrieve proxy record information in a script. Notice it uses the same notation as if the item datatype is a record.|
code=<syntaxhighlight>
item it = $item[coffee pixie stick];
print("You can buy a "+ it +" at the "+ it.seller);
print(it +" will cost "+ it.spleen +" and give "+ it.adventures +" adventures.");
</syntaxhighlight>}}
 
 
Here's an example of displaying a proxy record in the CLI. Note that it displays all fields associated with that datatype.
<pre>
<pre>
> ash $item[coffee pixie stick]
> ash $item[coffee pixie stick]
Line 67: Line 77:


Returned: Sugar Rush
Returned: Sugar Rush
default => use either 1 Angry Farmer candy, 1 Tasty Fun Good rice candy, 1 Crimbo candied pecan, Crimbo fudge, Crimbo peppermint bark, 1 Breath mint
default => use either 1 Angry Farmer candy, 1 Tasty Fun Good rice candy, 1 Crimbo candied pecan,
Crimbo fudge, Crimbo peppermint bark, 1 Breath mint
note =>
note =>
all => aggregate boolean [string]
all => aggregate boolean [string]
Line 79: Line 90:
descid => 83695b70e0470a36125feca3198a16b4
descid => 83695b70e0470a36125feca3198a16b4
</pre>
</pre>
This data can be retrieved by a script using the same notation as a record, like this:
{{CodeSample
|code=<syntaxhighlight>
item it = $item[coffee pixie stick];
coinmaster master = to_coinmaster(it.seller);
</syntaxhighlight>}}

Revision as of 05:06, 10 August 2011

Proxy Records is a way for KoLmafia to pass additional information to the scripter. Many datatypes contain these proxy records. such as items, skills, effects and coinmasters. This information is referred to as proxy records because the manner of reference is similar to a field of a record.


This is an example of how to retrieve proxy record information in a script. Notice it uses the same notation as if the item datatype is a record.

item it = $item[coffee pixie stick];
print("You can buy a "+ it +" at the "+ it.seller);
print(it +" will cost "+ it.spleen +" and give "+ it.adventures +" adventures.");


Here's an example of displaying a proxy record in the CLI. Note that it displays all fields associated with that datatype.

> ash $item[coffee pixie stick]

Returned: coffee pixie stick
plural => coffee pixie sticks
descid => 936288573
image => cpstick.gif
levelreq => 4
quality =>
adventures => 5-10
muscle => 0
mysticality => 0
moxie => 0
fullness => 0
inebriety => 0
spleen => 4
notes =>
combat => false
reusable => false
usable => false
multi => true
seller => Arcade Ticket Counter
buyer => none

> ash $coinmaster[Arcade Ticket Counter]

Returned: Arcade Ticket Counter
token => ticket
item => Game Grid ticket
property =>
available_tokens => 10
buys => false
sells => true

> ash $location[Palindome]

Returned: Palindome
nocombats => false
zone => Plains
parent => Plains
parentdesc => Nearby Plains

> ash $skill[empathy of the newt]

Returned: Empathy of the Newt
level => 8
traincost => 6500
class => Turtle Tamer
libram => false
passive => false
buff => true
combat => false
permable => true

> ash $familiar[slimeling]

Returned: Slimeling
combat => true
hatchling => squirming Slime larva
image => slimeling.gif
name => Princess Vina

> ash $effect[sugar rush]

Returned: Sugar Rush
default => use either 1 Angry Farmer candy, 1 Tasty Fun Good rice candy, 1 Crimbo candied pecan,
 Crimbo fudge, Crimbo peppermint bark, 1 Breath mint
note =>
all => aggregate boolean [string]
  use 1 Angry Farmer candy => true
  use 1 Tasty Fun Good rice candy => true
  use 1 Crimbo candied pecan => true
  use Crimbo fudge => true
  use Crimbo peppermint bark => true
  use 1 Breath mint => true
image => http://images.kingdomofloathing.com/itemimages/hoppedup.gif
descid => 83695b70e0470a36125feca3198a16b4