I spent several hours making this half-finished system in order to perform chemistry (albeit a novice form) but am now wondering if there is a simpler, less redundant and time-consuming method... Here is my code:
Code: AGS
// CHEMISTRY
// DXM EXTRACTION
//USES iNH3 ON iRobo IF POSSIBLE
function iNH3_UseInv(){
if (player.ActiveInventory == iRobo){
Display ("You basify 30mL of cough syrup with 30mL of ammonia.");
player.InventoryQuantity[iNH3.ID] -= 30;
player.InventoryQuantity[iRobo.ID] -= 30;
player.AddInventory(iSyr_Amm);
player.InventoryQuantity[iSyr_Amm.ID] += 59;
}
}
//USES iRobo ON iNH3 IF POSSIBLE
function iRobo_UseInv(){
if (player.ActiveInventory == iNH3) {
Display ("You basify 30mL of cough syrup with 30mL of ammonia.");
player.InventoryQuantity[iNH3.ID] -= 30;
player.InventoryQuantity[iRobo.ID] -= 30;
player.AddInventory(iSyr_Amm);
player.InventoryQuantity[iSyr_Amm.ID] += 59;
}
}
// INSPECTS iRobo+iNH3 FLASK
function iSyr_Amm_Look(){
Display ("A flask filled with %dmL of ammonia and cough syrup", player.InventoryQuantity[iSyr_Amm.ID]);
}
// ADD 5mL OF iNaphtha TO FLASK OF 30mL iRobo+iNH3 IN POSSIBLE
function iNaphtha_UseInv()
{
if (player.InventoryQuantity[iSyr_Amm.ID] > 0){
Display ("You add 5mL of naphtha to 30ml of the ammonia/syrup");
player.InventoryQuantity[iNaphtha.ID] -= 5;
player.InventoryQuantity[iSyr_Amm.ID] -= 30;
player.AddInventory(iSyr_Amm_Nap);
player.InventoryQuantity[iSyr_Amm_Nap.ID] += 34;
}
else{
if (player.InventoryQuantity[iSyr_Amm.ID] < 1){
player.LoseInventory (iSyr_Amm);
}
}
}
// ADD 5mL OF iNaphtha TO FLASK OF 30mL iRobo+iNH3 IF POSSIBLE
function iSyr_Amm_UseInv()
{
if (player.InventoryQuantity[iSyr_Amm.ID] > 0){
Display ("You add 5mL of naphtha to 30ml of the ammonia/syrup");
player.InventoryQuantity[iNaphtha.ID] -= 5;
player.InventoryQuantity[iSyr_Amm.ID] -= 30;
player.AddInventory(iSyr_Amm_Nap);
player.InventoryQuantity[iSyr_Amm_Nap.ID] += 34;
}
else{
if (player.InventoryQuantity[iSyr_Amm.ID] < 1){
player.LoseInventory (iSyr_Amm);
}
}
}
// INSPECTS iRobo+iNH3+iNaphtha FLASK
function iSyr_Amm_Nap_Look()
{
Display ("A flask filled with an %dmL of an immiscible mixture of ammonia/ cough syrup and naphtha at 30mL:5mL", player.InventoryQuantity[iSyr_Amm_Nap.ID]);
}