D
DarkArtJason
Guest
I'm am totally lost with the IAP example when trying to create a IAP code to do just one simple little thing.
I'm not trying to sell things over and over again I just want to offer people an option to open up a certain room after they buy a ticket. Attempting to follow the example and a few other tortillas on IAP my mind is now just overwhelmed. It is most likely something simple I'm overlooking but here is the codes I created>>>
I first started with creating an obj_IAP_initiate’ and add a ‘Create’ event to it>>>
/// IAP initiate
Product_List = ds_list_create();
Green = ds_map_create();
Gold = ds_map_create();
ds_map_add(Green, "id", "myproducti'mselling1");
ds_map_add(Gold, "id", "myproducti'mselling2");
if(os_type == os_winphone){
ds_map_add(Green, "type", "Durable");
ds_map_add(Green, "title", "Field Goal");
ds_map_add(Gold, "type", "Durable");
ds_map_add(Gold, "title", Pass Ticket");
}
ds_list_add(Product_List,Green);
ds_list_add(Product_Gold);
iap_activate(Product_List);
ds_map_destroy(Green);
ds_map_destroy(Gold);
ds_list_destroy(Product_List);
After that I created two Left Pressed buttons and and dragged into each one this code>>>
button 1
iap_acquire("myproducti'mselling1", "");
button 2
iap_acquire("myproducti'mselling2", "");
After that I created an obj_IAP_Handle using the Asynchronous’ and select ‘IAP’. Drag & drop an ‘Execute Code’ and added this code>>>
var val = ds_map_find_value(iap_data, "type");
switch (val){
case iap_ev_purchase:
var map = ds_map_create();
var purchase_id = ds_map_find_value(iap_data, "index");
iap_purchase_details(purchase_id, map);
if (ds_map_find_value(map, "status") == iap_purchased){
var product_id = ds_map_find_value(map, "product");
iap_consume(product_id);
}
ds_map_destroy(map);
break;
case iap_ev_consume:
var product_id = ds_map_find_value(iap_data, "product");
if (ds_map_find_value(iap_data, "consumed")){
// Go To Room Green
if(product_id == "myproducti'mselling1"){
room_goto(rm_Room1);
break;
case iap_ev_consume:
var product_id = ds_map_find_value(iap_data, "product");
if (ds_map_find_value(iap_data, "consumed")){
// Go To Room Gold
if(product_id == "myproducti'mselling2"){
room_goto(rm_Room2);
break;
}
}
}
break;
}
}
I have attempted to go back and reread the example many times and have tried looking into other tutorials to find what code I should be using. Again all I want is to sell people a single ticket. After they buy it they are free to enter a room So I ask,"What am I not doing correctly here?". Without adding the google play services or these codes everything works great. But after adding them and try to create an application I get "UNFORTUNATELY ,(name of game) Has Stopped".
I'm not trying to sell things over and over again I just want to offer people an option to open up a certain room after they buy a ticket. Attempting to follow the example and a few other tortillas on IAP my mind is now just overwhelmed. It is most likely something simple I'm overlooking but here is the codes I created>>>
I first started with creating an obj_IAP_initiate’ and add a ‘Create’ event to it>>>
/// IAP initiate
Product_List = ds_list_create();
Green = ds_map_create();
Gold = ds_map_create();
ds_map_add(Green, "id", "myproducti'mselling1");
ds_map_add(Gold, "id", "myproducti'mselling2");
if(os_type == os_winphone){
ds_map_add(Green, "type", "Durable");
ds_map_add(Green, "title", "Field Goal");
ds_map_add(Gold, "type", "Durable");
ds_map_add(Gold, "title", Pass Ticket");
}
ds_list_add(Product_List,Green);
ds_list_add(Product_Gold);
iap_activate(Product_List);
ds_map_destroy(Green);
ds_map_destroy(Gold);
ds_list_destroy(Product_List);
After that I created two Left Pressed buttons and and dragged into each one this code>>>
button 1
iap_acquire("myproducti'mselling1", "");
button 2
iap_acquire("myproducti'mselling2", "");
After that I created an obj_IAP_Handle using the Asynchronous’ and select ‘IAP’. Drag & drop an ‘Execute Code’ and added this code>>>
var val = ds_map_find_value(iap_data, "type");
switch (val){
case iap_ev_purchase:
var map = ds_map_create();
var purchase_id = ds_map_find_value(iap_data, "index");
iap_purchase_details(purchase_id, map);
if (ds_map_find_value(map, "status") == iap_purchased){
var product_id = ds_map_find_value(map, "product");
iap_consume(product_id);
}
ds_map_destroy(map);
break;
case iap_ev_consume:
var product_id = ds_map_find_value(iap_data, "product");
if (ds_map_find_value(iap_data, "consumed")){
// Go To Room Green
if(product_id == "myproducti'mselling1"){
room_goto(rm_Room1);
break;
case iap_ev_consume:
var product_id = ds_map_find_value(iap_data, "product");
if (ds_map_find_value(iap_data, "consumed")){
// Go To Room Gold
if(product_id == "myproducti'mselling2"){
room_goto(rm_Room2);
break;
}
}
}
break;
}
}
I have attempted to go back and reread the example many times and have tried looking into other tutorials to find what code I should be using. Again all I want is to sell people a single ticket. After they buy it they are free to enter a room So I ask,"What am I not doing correctly here?". Without adding the google play services or these codes everything works great. But after adding them and try to create an application I get "UNFORTUNATELY ,(name of game) Has Stopped".