Difference between pages "Gametime to int" and "Proxy Records"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Theraze
 
imported>Bale
(starting page. Needs tons of work)
 
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.
#vardefine:name|gametime_to_int}}{{
 
#vardefine:return_type|int}}{{
 
  
FunctionPage|
+
Here's an example of displaying proxy record information in the CLI
name={{#var:name}}|
+
<pre>
 +
> ash $item[coffee pixie stick]
  
function1={{Function|
+
Returned: coffee pixie stick
name={{#var:name}}|
+
plural => coffee pixie sticks
aggregate={{#var:aggregate}}|
+
descid => 936288573
return_type={{#var:return_type}}|
+
image => cpstick.gif
return_also={{#var:return_also}}|
+
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
  
function_description=Returns the current KoL game time using milliseconds since rollover.|
+
> ash $coinmaster[Arcade Ticket Counter]
  
code1={{CodeSample|
+
Returned: Arcade Ticket Counter
title=Code Sample 1|
+
token => ticket
description=This code will tell you how many MS it took to list the gCLI commands.|
+
item => Game Grid ticket
code=<syntaxhighlight>
+
property =>
int starttime = gametime_to_int();
+
available_tokens => 10
CLI_EXECUTE("help");
+
buys => false
print("It took "+(gametime_to_int()-starttime)+" MS to list all gCLI commands.");
+
sells => true
</syntaxhighlight>}}|
 
  
code2={{CodeSample|
+
> ash $location[Palindome]
title=Code Sample 2|
 
description=This code will tell you how many MS it has been since KoL's official rollover time.|
 
code=<syntaxhighlight>
 
print("It has been "+gametime_to_int()+" MS since the rollover began.");
 
</syntaxhighlight>}}|
 
  
code3={{CodeSample|
+
Returned: Palindome
title=Code Sample 3|
+
nocombats => false
description=This code will tell you long since KoL's official rollover time began without hitting the server.|
+
zone => Plains
code=<syntaxhighlight>
+
parent => Plains
print("It has been "+(gametime_to_int() / (86400000 / 24)) + ":" + ((gametime_to_int() / (86400000 / 1440)) % 60)+" since the rollover began.");
+
parentdesc => Nearby Plains
</syntaxhighlight>}}|
 
  
code4={{CodeSample|
+
> ash $skill[empathy of the newt]
title=Code Sample 4|
 
description=This code will tell you how long until KoL's next official rollover time.|
 
code=<syntaxhighlight>
 
print("You have "+(23 - (gametime_to_int() / (86400000 / 24)))+":"+(59 - ((gametime_to_int() / (86400000 / 1440)) % 60))+" left until rollover begins.")
 
</syntaxhighlight>}}|
 
}}
 
  
{{SeeAlso|today_to_string|gameday_to_int|gameday_to_string|time_to_string|now_to_string}}
+
Returned: Empathy of the Newt
 +
level => 8
 +
traincost => 6500
 +
class => Turtle Tamer
 +
libram => false
 +
passive => false
 +
buff => true
 +
combat => false
 +
permable => true
  
[[Category:Miscellaneous Functions]]
+
> 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
 +
</pre>
 +
 
 +
This data can be retrieved by a script using the same notation as a record, like this:
 +
 
 +
{{CodeSample
 +
|code=<syntaxhighlight>
 +
coinmaster master = to_coinmaster(it.seller);
 +
</syntaxhighlight>}}

Revision as of 01:55, 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 their display is similar to the record datatype.

Here's an example of displaying proxy record information in the CLI

> 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

This data can be retrieved by a script using the same notation as a record, like this:


coinmaster master = to_coinmaster(it.seller);