API:DonateToAltar
From RoR Wiki
UI Lua API · RvR functions
Version: WAR 1.4.8
Asks the server to donate items to the altar the player is interacting with.
DonateToAltar(donationType, amount)
Arguments
- donationType
number– Kind of donation. The stock UI passesEA_Window_InteractionAltar.donationType. Only the low 16 bits are sent.- amount
number– Number of items to donate.
Returns
Nothing.
Details
- The request is sent as an interaction with the object the player last interacted with, together with both values. Nothing is sent if there is no such object or if the network connection is not ready.
- The client does not check
amountagainst the backpack. The stock altar window does: if the player asks for more than they carry, it offers to donate everything instead. - The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
From default/ea_interactionwindow/source/interactionaltar.lua:
local amount = tonumber( TextEditBoxGetText( "EA_Window_InteractionAltarDonationEditBox" ) )
if ( amount > 0 ) then
if ( amount <= EA_Window_InteractionAltar.numItemsInBackpack ) then
DonateToAltar( EA_Window_InteractionAltar.donationType, amount )
else
...
