Game Development Community

Problems with removeField

by John Coyne · in Torque Game Builder · 05/16/2006 (11:18 am) · 2 replies

Are there any known problems with the "removeField" command. I'm storing co-ordinates in a string with setField, and from what I see, removeField does nothing at all.

function Slide::DeleteNextPoint(%this)
{
   echo("delete next point called");
   echo("Delete called on " @ getField(%this.slidePath, (getFieldCount(%this.slidePath)-1)));
   removeField(%this.slidePath, (getFieldCount(%this.slidePath)-1));
}


function playerUp()
{
   $slide.AddToEnd("0 0");
   $slide.dumpSlide();
}

function playerDown()
{
   $slide.deleteNextPoint();
   $slide.dumpSlide();
}


after adding 2 fields then attempting to delete 2 the console shows no change on deleting.
**Dumping slide data**
Count = 0
Field = 0 0
**End slide data dump**
**Dumping slide data**
Count = 0
Field = 0 0
Count = 1
Field = 0 0
**End slide data dump**


delete next point called
Delete called on 0 0
**Dumping slide data**
Count = 0
Field = 0 0
Count = 1
Field = 0 0
**End slide data dump**
delete next point called
Delete called on 0 0
**Dumping slide data**
Count = 0
Field = 0 0
Count = 1
Field = 0 0
**End slide data dump**

#1
05/16/2006 (5:10 pm)
It doesn't change the string object, it returns the new version, so you need to do:

%this.slidePath = removeField(%this.slidePath, (getFieldCount(%this.slidePath)-1));
#2
05/17/2006 (2:31 am)
DOH!
Thanks very much Luke. :)