Acording to the command reference: Free "Class", ID [, Count]
(I know that you don't put brackets, the brackets are there to tell that part of the syntax is OPTIONAL)
Scripts
The command "free" doesn't work with variables
The command "free" doesn't work with variables
1

on:use {
$xofobj = getx ("self", self); //remove self
$yofobj = gety ("self", self); //remove self
$zofobj = getz ("self" self); //remove self & missing comma
$yawofobj = getyaw ("self", self); //remove self
$classofobj = currentclass();
$idofobj = currentid();
$nameofobj = name ($classofobj, $idofobj);
play "barkbranchfire.wav";
msg "An $nameofobj ($classofobj) with an id of $idofobj and yaw rotation of $yawofobj has been removed at x: $xofobj, y: $yofobj, z: $zofobj", 1, 6000;
free $classofobj, $idofobj, 1;
}
on:use {
$xofobj = getx ("self");
$yofobj = gety ("self");
$zofobj = getz ("self");
$yawofobj = getyaw ("self");
$classofobj = currentclass();
$idofobj = currentid();
$nameofobj = name ($classofobj, $idofobj);
play "barkbranchfire.wav";
msg "An $nameofobj ($classofobj) with an id of $idofobj and yaw rotation of $yawofobj has been removed at x: $xofobj, y: $yofobj, z: $zofobj", 1, 6000;
free $classofobj, $idofobj, 1;
}
free $classofobj, $idofobj, 1;
free "self";
JasJack67: $nameofobj = name ($classofobj, $idofobj);
$nameofobj = name ("$classofobj", $idofobj); addscript "$type", $id2, 5;
addscript "$type", $id2, "5";
freeze "$id2", 1;
freeze $id2, 1;
$id2 = create ($type, $placement, $placex, $placez);
$id2 = create ("$type", $placement, $placex, $placez);
setrot "$type", $id2, self, $placeyaw, self;
setrot "$type", $id2, "self", $placeyaw, "self";
JasJack67: free self;
free "self";
page=bush
title=Planting Bush
text=start
!4I have chosen to plant a bush.
!4What bush shall I plant?
!5Other fruiting bushes can be
!5grown by planting it's fruit.
!5Such as, Hemp, Tomato, Potato,
!5Corn, Berry, Grape, Grain, and
!5Flowers.
text=end
ibutton=gfx\icons\baldbush01.bmp, bush1, Bald Bush
ibutton=gfx\icons\bush04.bmp, bush2, Variegated Bush
ibutton=gfx\icons\bush11.bmp, bush3, Denseleaf Bush
page=bush1
script=start
$x=use_x();
$y=use_y();
$z=use_z();
freestored "unit",1,15,1;
$typ=22;
$id=create("object",$typ,$x,$z);
$tmp=growtime($typ);
$tmp=(-$tmp);
$tmp++;
spawntimer $id,$tmp;
if (skillvalue("plant")>=200){
process "planting bald bush",300;
}else{
process "planting bald bush",3000;
}
play "dig.wav";
play "mat_leaf1.wav";
event "iskill_plant","global";
closemenu;
script=end
page=bush2
script=start
$x=use_x();
$y=use_y();
$z=use_z();
freestored "unit",1,15,1;
$typ=26;
$id=create("object",$typ,$x,$z);
$tmp=growtime($typ);
$tmp=(-$tmp);
$tmp++;
spawntimer $id,$tmp;
if (skillvalue("plant")>=200){
process "planting variegated bush",300;
}else{
process "planting variegated bush",3000;
}
play "dig.wav";
play "mat_leaf1.wav";
event "iskill_plant","global";
closemenu;
script=end
page=bush3
script=start
$x=use_x();
$y=use_y();
$z=use_z();
freestored "unit",1,15,1;
$typ=55;
$id=create("object",$typ,$x,$z);
$tmp=growtime($typ);
$tmp=(-$tmp);
$tmp++;
spawntimer $id,$tmp;
if (skillvalue("plant")>=200){
process "planting denseleaf bush",300;
}else{
process "planting denseleaf bush",3000;
}
play "dig.wav";
play "mat_leaf1.wav";
event "iskill_plant","global";
closemenu;
script=end
JasJack67: $yawtext = "0 Dagrees Yaw";
$yawtext = 0;
msg "$yawtext Dagrees Yaw";
$choosetext="Orange Butterfly";
$settype="unit";
JasJack67: on:selectplace {
$placex = selectplace_x();
$placez = selectplace_z();
$placement = $selchoose;
$type = $settype; //this $settype is that text variable from your page=spawnunit
$placeyaw = $setyaw;
$id2 = create ($type, $placement, $placex, $placez);
setrot "$type", $id2, self, $placeyaw, self;
addstate "$type", $id2, 17;
addscript "$type", $id2, 5;
freeze $id2, 1;
play "magic.wav";
closemenu;
}
$type = currentclass();
JasJack67: $id2 = create("$type", $placement, $placex, $placez);
xjonx has writtenfree "object", $id, $penamount; //results in a "expecting semicolon" error
free command reference it says:
JasJack67:
Hurri04: 
local "$zofobj = getz ("self"); local "$zofobj = getz ("self")"; on:create {
local $xofobj,$yofobj,$zofobj,$yawofobj,$classofobj,$idofobj,$nameofobj;
$xofobj = getx ("self");
$yofobj = gety ("self");
$zofobj = getz ("self");
$yawofobj = getyaw ("self");
$classofobj = currentclass();
$idofobj = currentid();
$nameofobj = name ("$classofobj", $idofobj);
}
JasJack67: on:spoilage4 {
	local $tmp,$tmp0,$tmp1,$tmp2,$id;
	$id=currentid();
	$tmp0=random(1,15);
	if($tmp0==1){
		$tmp=random(254,279);
	}elseif($tmp0==2){
		$tmp=random(9,16);
	}elseif($tmp0==3){
		$tmp=random(31,46);
	}elseif($tmp0<=5){
		$tmp=random(66,99);
	}elseif($tmp0<=7){
		$tmp=random(115,126);
	}elseif($tmp0==8){
		$tmp=random(3700,3710);
	}elseif($tmp0==9){
		$tmp=random(3610,3630);
	}elseif($tmp0<=11){
		$tmp=random(4873,4892);
	}elseif($tmp0==12){
		$tmp=random(4902,4909);
	}else{
		$tmp=random(4958,4995);
	}
	if($tmp==119){
		if(count_stored("unit",1,119)>=1){
			msg "Worm",1,9000;
			msg "...has spoiled!",3,9150;
			freestored "unit",1,119,1;
			$id=create("item",4888,0,0);
			store $id,"unit",1;
		}
	}elseif($tmp==256){
		if(count_stored("unit",1,256)>=1){
			msg "Corn Shuck",1,9000;
			msg "...has spoiled!",3,9150;
			freestored "unit",1,256,1;
			$id=create("item",4888,0,0);
			store $id,"unit",1;
		}
	}elseif($tmp==257){
		if(count_stored("unit",1,257)>=1){
			msg "Corn Cob",1,9000;
			msg "...has spoiled!",3,9150;
			freestored "unit",1,257,1;
			$id=create("item",4888,0,0);
			store $id,"unit",1;
		}
	}elseif($tmp==3618){
		if(count_stored("unit",1,3618)>=1){
			msg "Chicken Sandwich",1,9000;
			msg "...has spoiled!",3,9150;
			freestored "unit",1,3618,1;
			$id=create("item",4888,0,0);
			store $id,"unit",1;
		}
	}elseif($tmp==3619){
		if(count_stored("unit",1,3619)>=1){
			msg "Fish Sandwich",1,9000;
			msg "...has spoiled!",3,9150;
			freestored "unit",1,3619,1;
			$id=create("item",4888,0,0);
			store $id,"unit",1;
		}
	}elseif($tmp==278){
		if(count_stored("unit",1,278)>=1){
			msg "Fertile Cornseed",1,9000;
			msg "...has spoiled!",3,9150;
			freestored "unit",1,278,1;
			$id=create("item",4888,0,0);
			store $id,"unit",1;
		}
	}elseif(count_stored("unit",1,$tmp)>=1){
		$tmp1=getstored("unit",1,$tmp);
		if(compare_material("item",$tmp1,"none")==1){
			$tmp2=name("item",$tmp);
			msg "$tmp2",1,9000;
			msg "...has spoiled!",3,9150;
			freestored "unit",1,$tmp,1;
			$id=create("item",4888,0,0);
			store $id,"unit",1;
		}
	}
}
JasJack67:
JasJack67: the problem you describe is one I encountered myself once.$tmp2=name("item",$tmp); where the
name command tries to return "worm", the = operator tries to assign the $tmp2 variable with "w||m". the result of this operation can only be 0 or 1. and unless "w" and "m" are interpreted as variables without a "$" in front, that leaves only 0.
1
