Author Topic: Perciptation Code.  (Read 1314 times)

I am learning how to script now and I was wondering how to make a datablock and see if it renders in-game with bobandrobs snow script.



This is the rain.cs
Code: [Select]
datablock PrecipitationData(Rain)
{
   dropTexture = "./rain";
   splashTexture = "./splashrain";
   dropSize = 10;
   splashSize = 0.1;
   useTrueBillboards = false;
   splashMS = 250;
};

To clear some confusion would this is how my Sever_Rain file looks:

Rain.cs
Server.cs
Description.txt (Title: rain datablock Author etc.)
rain.jpg (rain from slate strom)
splashrain.jpg (splash water from slate storm)

This is the server.cs
Code: [Select]
exec("./rain.cs");
And would I put it in a script (this is bobandrobs) like this?

Code: [Select]
function serverCmdRain(%client, %amt) {
if(!%client.isAdmin)
return messageClient(%client, '', '\c6You need to be an admin to use this command.');
while(isObject(cloud))
cloud.delete();
%amt = mFloor(%amt);
if(%amt <= 0)
return messageClient(%client, '', '\c6It stopped raining.');
new precipitation(cloud) {
position = "0 0 600";
rotation = "1 0 0 0";
scale = "1 1 1";
nameTag = "Rain";
dataBlock= "Rain OR Server_Rain(which name do I use?)";
minSpeed = "0.5";
maxSpeed = "1";
minMass = "0.75";
maxMass = "0.85";
maxTurbulence = "0.1";
turbulenceSpeed = "0.2";
rotateWithCamVel = "1";
useTurbulence = "1";
numDrops = %amt;
boxWidth = "100";
boxHeight = "100";
doCollision = "1";
};
messageAll('', '\c6It\'s now raining at a rate of \c3%1\c6 raindrops per something!', %amt);
}
But every time I type /rain 100 i see nothing so I then look into the console and get this:    
Object 'Rain' is not a member of the 'GameBaseData' data block class
Add-Ons/Script_Rain/server.cs <27> : Register object failed for object cloud of class Precipitation.
« Last Edit: December 22, 2009, 03:08:38 PM by cool-cat »

This is the rain.cs
Code: [Select]
datablock PrecipitationData(Rain)
{
   dropTexture = "./rain";
   splashTexture = "./splashrain";
   dropSize = 10;
   splashSize = 0.1;
   useTrueBillboards = false;
   splashMS = 250;
};

Object 'Rain' is not a member of the 'GameBaseData' data block class
Add-Ons/Script_Rain/server.cs <27> : Register object failed for object cloud of class Precipitation.
Your error is in your rain datablock, and when you try to make the raincloud (you should name it something other than cloud or else it'll conflict with snow) you try to use a non-existant datablock, and therefore blockland yells at you.

Fix your datablock, problem solved.

dataBlock= "Rain OR Server_Rain(which name do I use?)";
What do you think? The fields name is DATABLOCK, so do you think you should use the name of the DATABLOCK or some useless part of an arbitrary location of your script.

Also, if your texture is from slate storm, don't make another copy, just point to their files so that people don't need to have 2 copies of the same file.

Also, if slate storm uses it, just create that exact same datablock (if it doesn't already exist) and use that. Reinventing the wheel is bad.

Your error is in your rain datablock, and when you try to make the raincloud (you should name it something other than cloud or else it'll conflict with snow) you try to use a non-existant datablock, and therefore blockland yells at you.

Fix your datablock, problem solved.
Just so I don't screw up again could you tell me EXACTLY what to fix because I'm having a brain fart today.

Just so I don't screw up again could you tell me EXACTLY what to fix because I'm having a brain fart today.
No. If I told you "EXACTLY" what to fix, you wouldn't find the problem on your own, and you wouldn't learn from your mistake. Then in the future, you might make the same mistake again, and come back to the forums asking for us to fix it for you. It is better that you fix it on your own and learn how to script than have us fix your scripts for you.

If you want to fix it, look at the following paragraph.

Your error is in your rain datablock, and when you try to make the raincloud (you should name it something other than cloud or else it'll conflict with snow) you try to use a non-existant datablock, and therefore blockland yells at you.

Thanks I don't know why I went blank there.
Would this work?

Code: [Select]
function serverCmdRain(%client, %amt) {
if(!%client.isAdmin)
return messageClient(%client, '', '\c6You need to be an admin to use this command.');
while(isObject(raincloud))
raincloud.delete();
%amt = mFloor(%amt);
if(%amt <= 0)
return messageClient(%client, '', '\c6It stopped raining.');
new precipitation(raincloud) {
position = "0 0 600";
rotation = "1 0 0 0";
scale = "1 1 1";
nameTag = "Rain";
dataBlock= "Rain";
minSpeed = "0.5";
maxSpeed = "1";
minMass = "0.75";
maxMass = "0.85";
maxTurbulence = "0.1";
turbulenceSpeed = "0.2";
rotateWithCamVel = "1";
useTurbulence = "1";
numDrops = %amt;
boxWidth = "100";
boxHeight = "100";
doCollision = "1";
};
messageAll('', '\c6It\'s now raining at a rate of \c3%1\c6 raindrops per something!', %amt);
}



The rain data block is in a different file known as Server_Rain
And the Script is in a different on known as Script_Rain. Just putting that there because I still have the error <27>
Quote from: bobandrob
You are using a non-exsistent datablock and that is why blockland is yelling at you.
But i made the Datablock in Server_rain.
« Last Edit: December 22, 2009, 03:12:51 PM by cool-cat »

If you want to fix it, look at the following paragraph.

Nah, that was just a suggestion, not where his problem lies.

Nah, that was just a suggestion, not where his problem lies.
Woops, must've been a other topic I was look at. The player forgot to set the Datablock's name to "Rain".

Woops, must've been a other topic I was look at. The player forgot to set the Datablock's name to "Rain".
I did? I thought the name was specified in line one of the rain.cs.. Now I think I did everything wrong.

Woops, must've been a other topic I was look at. The player forgot to set the Datablock's name to "Rain".
http://forum.blockland.us/index.php?topic=93559.0 ?

I did? I thought the name was specified in line one of the rain.cs.. Now I think I did everything wrong.
datablock PrecipitationData(Rain) {
It is.

I know I being a pain in the butt, but (lol) could you give a hint (like what line(s) the error is on) please.
NVM i accidentally forgot to chack the Server_Rain in the add-ons list lol. Now I just need a texture......... I can't use Autumn pond since it needs to be re-ported. And slate storm's rain can't work..
« Last Edit: December 22, 2009, 09:03:43 PM by cool-cat »