Difference between pages "My path" and "Proxy Records"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Fredg1
 
imported>Bale
(added bounty proxy information in r9881)
 
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, monsters 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]].
#vardefine:name|my_path}}{{
 
#vardefine:return_type|string}}{{
 
  
FunctionPage|
 
name={{#var:name}}|
 
  
function1={{Function|
+
{{CodeSample|
name={{#var:name}}|
+
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.|
aggregate={{#var:aggregate}}|
+
code=<syntaxhighlight>
return_type={{#var:return_type}}|
+
item it = $item[coffee pixie stick];
return_also={{#var:return_also}}|
+
print("You can buy a "+ it +" at the "+ it.seller);
}}|
+
print("It will consume "+ it.spleen +" spleen and give "+ it.adventures +" adventures.");
 +
</syntaxhighlight>}}
  
function_description=Returns the path your character chose upon ascension ("None" when in aftercore).|
 
  
code1={{CodeSample|
+
Here's an example of displaying a proxy record in the CLI. Note that it displays all fields associated with that datatype.
title=Code Samples|
+
<pre>
description=This prints all the affects of your moon sign.|
+
> ash $item[coffee pixie stick]
code=<syntaxhighlight>
+
 
if(my_path() == "Bees Hate You")
+
Returned: coffee pixie stick
  print("I'm doing a Bees Hate You run.");
+
plural => coffee pixie sticks
else print("Bees do not hate me, thank goodness.");
+
descid => 936288573
</syntaxhighlight>
+
image => cpstick.gif
}}|
+
levelreq => 4
see_also={{SeeAlso|my_sign|knoll_available|canadia_available|gnomads_available}}|
+
quality =>
special=This function returns "None" when not logged in.|
+
adventures => 5-10
}}
+
muscle => 0
 +
mysticality => 0
 +
moxie => 0
 +
fullness => 0
 +
inebriety => 0
 +
spleen => 4
 +
notes =>
 +
combat => false
 +
reusable => false
 +
usable => false
 +
multi => true
 +
bounty => none
 +
bounty_count => 0
 +
seller => Arcade Ticket Counter
 +
buyer => none
 +
 
 +
> ash $coinmaster[Arcade Ticket Counter]
 +
 
 +
Returned: Arcade Ticket Counter
 +
token => ticket
 +
item => Game Grid ticket
 +
property =>
 +
available_tokens => 0
 +
buys => false
 +
sells => true
 +
 
 +
> ash $location[Fantasy Airship]
 +
 
 +
Returned: Fantasy Airship
 +
nocombats => false
 +
zone => Beanstalk
 +
parent => Plains
 +
parentdesc => Nearby Plains
 +
bounty => burned-out arcanodiode
 +
 
 +
> ash $item[burned-out arcanodiode]
 +
 
 +
Returned: burned-out arcanodiode
 +
plural => burned-out arcanodiodes
 +
descid => 207784873
 +
image => diode.gif
 +
levelreq => 0
 +
quality =>
 +
adventures =>
 +
muscle =>
 +
mysticality =>
 +
moxie =>
 +
fullness => 0
 +
inebriety => 0
 +
spleen => 0
 +
notes =>
 +
combat => false
 +
reusable => false
 +
usable => false
 +
multi => false
 +
bounty => Fantasy Airship
 +
bounty_count => 5
 +
seller => none
 +
buyer => none
 +
 
 +
> 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 $monster[black widow]
 +
 
 +
Returned: Black Widow
 +
base_hp => 130
 +
base_attack => 139
 +
base_defense => 128
 +
base_initiative => 0
 +
attack_element => none
 +
defense_element => none
 +
min_meat => 40
 +
max_meat => 60
 +
base_mainstat_exp => 17.375
 +
phylum => bug
 +
poison => Really Quite Poisoned
 +
 
 +
> 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
 +
</pre>
  
[[Category:Your Character]]
+
[[Category:Scripting]]

Revision as of 08:40, 11 October 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, monsters 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 consume "+ it.spleen +" 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
bounty => none
bounty_count => 0
seller => Arcade Ticket Counter
buyer => none

> ash $coinmaster[Arcade Ticket Counter]

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

> ash $location[Fantasy Airship]

Returned: Fantasy Airship
nocombats => false
zone => Beanstalk
parent => Plains
parentdesc => Nearby Plains
bounty => burned-out arcanodiode

> ash $item[burned-out arcanodiode]

Returned: burned-out arcanodiode
plural => burned-out arcanodiodes
descid => 207784873
image => diode.gif
levelreq => 0
quality =>
adventures =>
muscle =>
mysticality =>
moxie =>
fullness => 0
inebriety => 0
spleen => 0
notes =>
combat => false
reusable => false
usable => false
multi => false
bounty => Fantasy Airship
bounty_count => 5
seller => none
buyer => none

> 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 $monster[black widow]

Returned: Black Widow
base_hp => 130
base_attack => 139
base_defense => 128
base_initiative => 0
attack_element => none
defense_element => none
min_meat => 40
max_meat => 60
base_mainstat_exp => 17.375
phylum => bug
poison => Really Quite Poisoned

> 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