Chilliden wrote:
Code:
var dirt_portion := CInt(GetObjProperty(bowl, "DirtPortion"));
var targetted := Target(who);
SetObjProperty(bowl, "DirtPortion", dirt_portion);
if(targetted.objtype == Dirt)
dirt_portion := dirt_portion+1;
print(dirt_portion);
endif
Austin allready tryed to help, but it isn't working and i have no idea anymore. i just want to increment the var dirt_portion with one when they clicked the Dirt. PLs help

greetz
Read the comments for the code.. and I bet you'll find the mistake.
I didn't change anything, I just explained what the script is doing.
Code:
// Reads the cprop "DirtPortion" as an integer.
// If it is an error (non existant), CInt() will force it to be 0.
var dirt_portion := CInt(GetObjProperty(bowl, "DirtPortion"));
// Store an object that was targetted or an error if nothing was.
var targetted := Target(who);
// Save the value of dirt_portion as a cprop named DirtPortion
SetObjProperty(bowl, "DirtPortion", dirt_portion);
// Check if what was targetted has an object type matching the value stored in variable 'Dirt'.
if( targetted.objtype == Dirt )
// Increment the value of dirt_portion by 1
// Only occurs if the target and Dirt match.`
dirt_portion := dirt_portion+1;
// Print hte value of dirt_portion to the console.
print(dirt_portion);
endif
// If there was no match, do nothing further?