wiki.sine.space | sinespace

Difference between revisions of "Scripting/SEconomy"

From wiki.sine.space
Jump to: navigation, search
m
m
Line 21: Line 21:
 
Works on Preview or Live.
 
Works on Preview or Live.
  
Note: The above two keys do not work with TransferFromTo() function. You'll need an API Key which has that function enabled. </div>
+
Note: The above two keys work with DeductSilver() and AddSilver(). You'll need an API Key which has your specific required function enabled. </div>
  
 
=Members=
 
=Members=

Revision as of 09:52, 12 July 2021

API Keys

The SEconomy class gives us the ability to transfer silver or issue silver rewards from Sinespace's vault. Therefore, for the below methods to work, you will need to first set the AcessKey which is an API Key given by Sinespace.

To request an API Key, please message Adam (Adam#4065 on Discord) with: - A very brief description of what you're doing (game, etc.) - How much you want to give away (I would suggest aim for 2,000-5,000 per day, with each 'activity' generating no more than 500 per 10 minutes on average) - If you need the ability to 'sink' money too (sunken money = higher giveaway limits) - Which account should be responsible for the access key (in the event of teams, this will be the person with management rights over it)


Here's two API Keys which are pre-generated and available to the public:

b9184836-9c73-486a-b058-a0a668b860f7 Maximum 5000 silver per 24 hours per user, AND allows up to 5000 to be deducted as well. Works only on Preview.

11f55b74-69ee-4dd3-8983-17c466912beb Maximum 500 silver per 24 hours per user. Works on Preview or Live.

Note: The above two keys work with DeductSilver() and AddSilver(). You'll need an API Key which has your specific required function enabled.

Members

DeductSilver

void DeductSilver (int amount, Action< bool > onFinished);

Description


DeductSilver

void DeductSilver (int amount, Closure onFinished);

Description


AddSilver

void AddSilver (int amount, Action< bool > onFinished);



AddSilver

void AddSilver (int amount, Closure onFinished);

Adds amount of silver to player silver balance. You can also bind a function which will be called when operation is finished (optional). The source of the silver is Sinespace. This method requires AccessKey to be set first.

--the below script will give every player running it 1 silver every 10 seconds (from SineSpace)
--(Example: A silver giver that encourages visitors to stay)
--[The AccessKey we are using below is for preview servers only]

thisGameObject = Space.Host.ExecutingObject

Space.Economy.AccessKey = "b9184836-9c73-486a-b058-a0a668b860f7"


done = function()
  
  Space.Log("1 Silver Recieved")
end

AddSilverCoroutine = function()

Space.Economy.AddSilver(1, done)
coroutine.yield(10)

end



Space.Host.StartCoroutine(AddSilverCoroutine)


TransferSilverFrom

void TransferSilverFrom (int amount, string reason, int to, Action< bool > onFinished);

Description


TransferSilverFrom

void TransferSilverFrom (int amount, string reason, int to, Closure onFinished);

Description


IssueReward

void IssueReward (int id, Action< bool > onFinished);

Description


IssueReward

void IssueReward (int id, Closure onFinished);

Description


Properties

AccessKey

string AccessKey { set; };

Description