For Curtis, or anyone else that has an idea

Feedback, questions, updates on current projects, you name it!
Post Reply
nwhitney
Posts: 175
Joined: Wed Mar 28, 2007 3:33 pm
Location: Tioga, PA, USA

For Curtis, or anyone else that has an idea

Post by nwhitney »

I've got a problem with the animated load using product textures for Ken's gondola. In Surveyor, clicking Properties and then on the car to change the status of the load, only the last load, sand, remains visible after closing the Properties window. The car shows as loaded, but the load disappears. After saving the session, then re-opening, the car then shows the mesh and correct texture. Does anyone have any idea what's going on? The only extra thing is a script for random running numbers.
Here's the config

Code: Select all

kuid							<kuid2:132903:19216:2>
origin							"USA"
rem							"bogey							<kuid:242091:50251>"
bogey							<kuid:96914:50326>
engine							0
name							"30SRRL Gondola 24ft"
mass							3864
company							"SR&RL"
kind							"traincar"
script							"gondola"
class							"ARN_Gondola"
enginespec						<kuid:-1:42004201>
fonts							1
fonts-path						"flatcar"
category-region-0					"US"
category-region-1					"AU"
category-region-2					"NZ"
category-region-3					"CA"
category-era-0						"1940s"
category-era-1						"1930s"
category-era-2						"1920s"
category-era-3						"1910s"
category-era-4						"1900s"
category-era-5						"1890s"
category-era-6						"1880s"
category-era-7						"1870s"
category-class						"XSU"
asset-filename						"srrl_271"
icon0							<kuid:-3:10164>
obsolete-table {
}
mesh-table {
	default {
		mesh					"srrl_271_body/srrl_271_body.im"
		auto-create				1
		effects {
			arn_g0 {
				kind			"attachment"
				att			"a.rng0"
				default-mesh		<kuid2:104722:2511038:2>
			}
			arn_g1 {
				kind			"attachment"
				att			"a.rng1"
				default-mesh		<kuid2:104722:2511038:2>
			}
			0 {
				kind			"attachment"
				att			"a.couplerB"
				default-mesh		<kuid:371339:60018>
			}
			1 {
				kind			"attachment"
				att			"a.couplerA"
				default-mesh		<kuid:371339:60020>
			}
		}
	}
	sideboards {
		mesh					"srrl_271_body/HiSides.im"
		auto-create				1
		use-parent-bounds			1
	}
	load {
		mesh					"load/load.im"
		anim					"load/load.kin"
		auto-create				1
		use-parent-bounds			1
		effects {
			product-texture {
				kind			"texture-replacement"
				texture			"load_map.texture"
			}
		}
	}
}
queues {
	ballast {
		size					15857
		initial-count				0
		animated-mesh				"load"
		product-kuid				<kuid:113998:9003>
		allowed-categories {
			0				<kuid:-3:10040>
		}
		conflicts-with-queues {
			0				"woodchips"
			1				"coal"
			2				"sand"
		}
	}
	woodchips {
		size					15857
		initial-count				0
		animated-mesh				"load"
		product-kuid				<kuid:-3:10002>
		allowed-categories {
			0				<kuid:-3:10040>
		}
		conflicts-with-queues {
			0				"coal"
			1				"ballast"
			2				"sand"
		}
	}
	coal {
		size					15857
		initial-count				0
		animated-mesh				"load"
		product-kuid				<kuid:44179:60013>
		allowed-categories {
			0				<kuid:-3:10040>
		}
		conflicts-with-queues {
			0				"ballast"
			1				"woodchips"
			2				"sand"
		}
	}
	sand {
		size					15857
		initial-count				0
		animated-mesh				"load"
		product-kuid				<kuid2:43955:11004:1>
		allowed-categories {
			0				<kuid:-3:10040>
		}
		conflicts-with-queues {
			0				"ballast"
			1				"woodchips"
			2				"coal"
		}
	}
}
extensions {
	arn_data-132903 {
		number_low				"200"
		number_high				"299"
		number_colour				"3"
	}
}
trainz-build						2.4
thumbnail						
description						"Sandy River & Rangeley Lakes 30 inch gauge Gondola."
username						"30ng SR&RL Gondola 24ft"
author							"P.Pardoe-Matthews <Narrowgauge>"
organisation						
contact-email						"peterpar@internode.on.net"
contact-website						
license							"This item is supplied free of charge for use only by registered users of Trainz. It must not be modified, offered for sale or supplied as a part of a Payware package. It must not be provided for downloading on any site unless this is expressly permitted in writing by the copyright holder.

It is not classed as a low polygon design and no responsibility will be accepted for performance or other problems on the users computer arising from this or any other reason 

If any use is made of textures supplied as part of this model, this use must be acknowledged in the Description field of the Config.tx

P.Pardoe-Matthews Copyright 2003, 2004, 2005, 2006"
kuid-table {
	arn_lib						<kuid2:104722:2501038:4>
	arn_grid					<kuid2:104722:2511038:2>
	arn_icon					<kuid2:104722:1959365:2>
	nitrate						<kuid:86661:9310230>
	0						<kuid:96914:50326>
	1						<kuid:-1:42004201>
	2						<kuid:-3:10164>
	3						<kuid:371339:60018>
	4						<kuid:371339:60020>
	5						<kuid:113998:9003>
	6						<kuid:-3:10040>
	7						<kuid:-3:10002>
	8						<kuid:44179:60013>
	9						<kuid2:43955:11004:1>
}
and here's the script

Code: Select all

// ARN (AutoRunningNumbers) script for rolling stock,
// (c)Wulf_9/TrainzProRoutes.org, December 2004.
//
// Vehicle creators/scripters are encouraged to add this
// code to their scripts (if used), or use it as-is if
// not. The only stipulation is that you make sure the
// ARN Icon, kuid2:104722:1959365:1 is specified in the
// config.txt (icon0, icon1, etc) and in the kuid-table.
// * NOT TO BE USED IN PAYWARE WITHOUT PRIOR AGREEMENT *

include "vehicle.gs"

class ARN_Gondola isclass Vehicle {

  Asset meAsset;
  Library arnlib;
  MeshObject rng_left;
  MeshObject rng_right;
  Soup mySoup;
  string myNumber = " ";
  int myskin = 0;

  void SetNumber(string iNum, int c_id) {

    string[] theNum = Str.Tokens(iNum, ",");
    theNum[0] = "__________" + theNum[0];
    int s = c_id;
    int i;

    for (i = 0; i < 4; i++) {
      rng_left.SetFXNameText("carnumber_a" + i, " ");
      rng_left.SetFXNameText("carnumber_b" + i, " ");
      rng_right.SetFXNameText("carnumber_a" + i, " ");
      rng_right.SetFXNameText("carnumber_b" + i, " ");
    }

    rng_left.SetFXNameText("carnumber_a" + s, theNum[0]);
    rng_left.SetFXNameText("carnumber_b" + s, theNum[1]);
    rng_right.SetFXNameText("carnumber_a" + s, theNum[0]);
    rng_right.SetFXNameText("carnumber_b" + s, theNum[1]);
  }

  void CheckNumber(void) {

    int low = mySoup.GetNamedTagAsInt("number_low");
    int high = mySoup.GetNamedTagAsInt("number_high");
    int clr = mySoup.GetNamedTagAsInt("number_colour");
    int n;
    string[] CarNums = new string[0];
    string[] NumData = new string[0];
    CarNums[0] = meAsset.GetKUID().GetHTMLString();
    CarNums[1] = (string)myskin; // this will always be 0 unless you have multiple skins

    for (n = 0; n < (high - low); n++) {
      CarNums[n + 2] = (string)(low + n);
    }

// only take even numbers

    myNumber = arnlib.LibraryCall("RunningNumber", CarNums, null);
    NumData[0] = myNumber;
    SetNumber(arnlib.LibraryCall("FormatNumber", NumData, null), clr);
    SetRunningNumber(myNumber); // allows calling GetRunningNumber() on this vehicle
  }

  /* SetProperties is called by the game when any data which has been saved to the
  session file is to be recalled. This occurs when the session is first loaded and before the
  Object Property browser is called. This method is also when the user presses UNDO.in
  Surveyor.
  public void SetProperties(Soup soup)
  */

  float BeginLoad(LoadingReport report)
  {
    Asset meAsset = GetAsset();
    World.PlaySound(meAsset, "coal_load1.wav", 1000.0f, 20.0f, 1000.0f, me, "");
    return 0.0;


  }

    float BeginUnload(LoadingReport report)
  {
    Asset meAsset = GetAsset();
    World.PlaySound(meAsset, "coal_dump1.wav", 1000.0f, 20.0f, 1000.0f, me, "");
    return 1.0;
  }


  public void Init(void) {

    inherited();

    meAsset = GetAsset();
    string cr_ID = Str.Tokens(meAsset.GetKUID().GetHTMLString(), ":")[1];
    Soup extConf = meAsset.GetConfigSoup().GetNamedSoup("extensions");
    mySoup = extConf.GetNamedSoup("arn_data-" + cr_ID);
    arnlib = World.GetLibrary(meAsset.LookupKUIDTable("arn_lib"));
    rng_left = GetFXAttachment("arn_g0");
    rng_right = GetFXAttachment("arn_g1");
    CheckNumber();
    AddHandler(me,"Object","","VehicleHandler");
  }

};

Thanks for any help,
Norm
Dreadnought1
Posts: 80
Joined: Fri Oct 05, 2007 3:40 pm
Location: Melbourne, AUSTRALIA

Re: For Curtis, or anyone else that has an idea

Post by Dreadnought1 »

I posed this question on the Trainz forum about a year ago (as I'd noticed this problem with several different items of rollingstock from different creators) but while other people reported that they'd had exactly the same problem, no-one was able to provide an answer.

Cheers,
Dreadnought1
"Damn the torpedoes....Ahead!....Full Speed!"
- Adm. David Farragut on 5th August 1864
Pencil
Site Admin
Posts: 1287
Joined: Sat Oct 08, 2005 10:28 am
Location: Portland, Oregon

Re: For Curtis, or anyone else that has an idea

Post by Pencil »

Oops - I meant to reply to this, but got distracted with something else - sorry about that!
I'm not sure I understand the issue; is there any way you can send me the asset and I can play with it here?
Also, what version of trainz are you seeing this with?
nwhitney
Posts: 175
Joined: Wed Mar 28, 2007 3:33 pm
Location: Tioga, PA, USA

Re: For Curtis, or anyone else that has an idea

Post by nwhitney »

Thank you both Dreadnought and Curtis. I've sent the .cdp out to Curtis. Hopefully, he can figure out the problem.
Norm
Pencil
Site Admin
Posts: 1287
Joined: Sat Oct 08, 2005 10:28 am
Location: Portland, Oregon

Re: For Curtis, or anyone else that has an idea

Post by Pencil »

OK, I did a little bit of playing around. I don't know why it does it, but can you just use one queue with multiple products? Something like:

Code: Select all

queues {
   bulk {
      size               15857
      initial-count            0
      animated-mesh            "load"
      product-kuid            <kuid:113998:9003>
      allowed-categories {
         0             <kuid:-3:10040>
      }
      allowed-products {
	0		<kuid:113998:9003>
	1		<kuid:-3:10002>
	2		<kuid:44179:60013>
	3		<kuid2:43955:11004:1>
      }
   }
}
That seemed to fix the problem for me.
nwhitney
Posts: 175
Joined: Wed Mar 28, 2007 3:33 pm
Location: Tioga, PA, USA

Re: For Curtis, or anyone else that has an idea

Post by nwhitney »

Thank you very much, Curtis. I'm forever indebted to you. Again. I was concerned about half loads so added the conflict-with queues, and separate loads, but that doesn't seem to be an issue.
Thanks again,
Norm
Pencil
Site Admin
Posts: 1287
Joined: Sat Oct 08, 2005 10:28 am
Location: Portland, Oregon

Re: For Curtis, or anyone else that has an idea

Post by Pencil »

Generally, the load mixing issue is taken care of in the product itself - there's an 'allows-mixing' tag that is usually set to disallow mixing - especially in bulk products.
Post Reply