Editing Krafties Energy API
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 4: | Line 4: | ||
#Drag the script and config notecard into your object or prim | #Drag the script and config notecard into your object or prim | ||
− | #*" | + | #*"KraftiesEnergyAPI" script |
#*"Krafties Energy API Config" notcard | #*"Krafties Energy API Config" notcard | ||
#Edit the config notecard for the energy amounts payable to you. | #Edit the config notecard for the energy amounts payable to you. | ||
− | #*You can use | + | #*You can use upto 12 amounts seperated by commas. <code>0</code> = Any custom amount and allows players to say the amount they wish to give. |
#*:Example: <code><nowiki>ENERGY_PRICE=0,10,100,1000</nowiki></code> | #*:Example: <code><nowiki>ENERGY_PRICE=0,10,100,1000</nowiki></code> | ||
===Response=== | ===Response=== | ||
− | + | Succesfully transactions will fire a linked message which can be parsed: | |
:<code><nowiki>llMessageLinked(LINK_THIS, 0, "ENERGY_GIVEN|"+fromKey+"|"+toKey+"|"+(string)amount, "");</nowiki></code> | :<code><nowiki>llMessageLinked(LINK_THIS, 0, "ENERGY_GIVEN|"+fromKey+"|"+toKey+"|"+(string)amount, "");</nowiki></code> | ||
===An Example Script=== | ===An Example Script=== | ||
− | This is an example script, which would be placed into an object alongside the Energy API script and config notecard. This example gives the first object found in the | + | This is an example script, which would be placed into an object alongside the Energy API script and config notecard. This example gives the first object found in the object's inventory when someone uses the energy API to transfer energy through the object, essentially acting as a simple vendor. |
+ | NOTE: You'll have to set the energy amount buttons in the config notecard to match the PRICE variable! | ||
+ | :<code><nowiki> | ||
+ | |||
+ | llMessageLinked(LINK_THIS, 0, "ENERGY_GIVEN|"+fromKey+"|"+toKey+"|"+(string)amount, ""); | ||
− | |||
− | |||
integer PRICE = 100; | integer PRICE = 100; | ||
Line 40: | Line 42: | ||
} | } | ||
} | } | ||
− | </nowiki></ | + | |
+ | </nowiki></code> | ||
==Notes== | ==Notes== | ||
*Only transferable energy can be given | *Only transferable energy can be given |