How do I set the base64 of CanvasSnapshot as a variable?

Get help using Construct 2

Post » Sat Oct 11, 2014 1:24 am

Hi!

I'm using the 'Social' plugin from @armaldio which can send emails using Mandrill. There is an ability to also include an attachment, which needs to be in the form of a base64 string in the current version.
Using System->Take Snapshot and then System->On Canvas Snapshot i'm getting everything to trigger correctly; a screenshot gets taken at the right time (which i'm testing with Browser->Invoke Download so I know that part works! :) ) and the email plugin successfully sends me an email. The grief i'm having is just the attachment part - what to put in the field for 'Attachment in base64'.
So far I have been able to get it to send me a few 77B images (which are empty!) and some larger images which are the same size as the ones I get with Browser->Invoke Download but they're also empty.

So that I can potentially use it later, I thought it would be handy to save the CanvasSnapshot base64 result as a global variable. (there's likely another way to do that, but I know I can use global variables in armaldio's plugin so i'm going running with it!) I read somewhere that there are a few (does 23 sound right?) characters at the beginning of the generated string which are not needed, so I should be removing those before saving the string as a variable - correct me on that if i've misunderstood.

Hoping someone can guide me in the right direction!

TLDR: I want to set the base64 string of CanvasSnapshot as a global variable. How could I do this?

Thanks in advance!
B
10
S
1
Posts: 12
Reputation: 427

Post » Sat Oct 11, 2014 11:01 am

Happy to send some money via PayPal for help on this one as it is getting a little urgent. Have also posted in the Job Offer forum, so if you believe it to be worth some money to send me some code, feel free to PM a figure to me. I'm a bit of a sharing is caring person though, so i'm hoping to create a tutorial with a step by step of what I end up doing to help everyone else out!

Cheers
B
10
S
1
Posts: 12
Reputation: 427

Post » Sat Oct 11, 2014 11:40 am

That may sound stupid but... doesn't setting the variable to variable to CanvasSnapshot when it is ready do it?
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Oct 12, 2014 10:56 pm

Thanks @Aphrodite; that's what I did but it was emailing me an 'image' of the same size which was un-openable. Got a reply from the plugin's owner though; in the 'attachment' field I need to put
Code: Select all
tokenat(canvassnapshot, 1, ",")

which sends through everything fine.
Hooray!
B
10
S
1
Posts: 12
Reputation: 427


Return to How do I....?

Who is online

Users browsing this forum: Christmas, Yahoo [Bot], yippiez and 27 guests