Author Topic: Brick Making Limets  (Read 1859 times)

Oh honestly. If I wrote code that didn't have a design floor, this guy wouldn't have to do anything. The "design flaw" in your code is that it doesn't even charge the user money.

Please don't post code that has design flaws, laremere!
My code works for what it was coded to do, yours doesn't.  I simply said he'd have to change it to suite his needs.

I believe there is a function to get the brick volume that could condense the code a bit lare.
Possibly, but I used the values that calculate the cost to also see if the bricks are too big to be made out of snow.
« Last Edit: November 01, 2008, 03:34:04 PM by laremere »

Code: [Select]
if(%brick.dataBlock.cost !$= "")
{
 %cost = %brick.dataBlock.cost;
}
else
{
 %cost = mCeil(%brick.dataBlock.brickSizeX * %brick.dataBlock.brickSizeY * (%brick.dataBlock.brickSizeZ/3));
}
//Do stuff with %cost

Calculates %brick's cost from either its volume (in whole bricks, rounded upwards) or the cost field set in its datablock for special bricks.

1x1 = 1 x 1 x (3/3) = 1
1x1f = 1 x 1 x (1/3) = 1/3 rounds up to 1
2x4 = 2 x 4 x (3/3) = 8

For something like a Vehicle Spawn or Music Brick, it may be 'worth' more than the physical size of the brick:
Vehicle Spawn normally: 8 x 8 x (1 / 3) = 211/3 rounds up to 22

If you set the cost field:
Code: [Select]
brickVehicleSpawnData.cost = 100;
... then it would cost that much instead.
« Last Edit: November 01, 2008, 03:40:43 PM by Space Guy »

My code works for what it was coded to do, yours doesn't.  I simply said he'd have to change it to suite his needs.
Possibly, but I used the values that calculate the cost to also see if the bricks are too big to be made out of snow.

I said it costs money to plant a brick and it does indeed. That's what I said it did, and that's what it does. Atleast I actually took the time to write a base for him to work off instead of pasting some irrelevant stuff from somewhere else.

Your code has the design flaw of the fact that it cost money even if you get the brick error, so I posted code that I did to show him how to make code that went around this.  Like you keep saying, this is coding help, so I posted a script that would show him how to do it, and didn't just give him a finished code that I easily could have done by basing it off of my code.  You posted a code that does work, but it has a serious design flaw, that is in the first place harder to get around from the standpoint of a new coder then it is to do it another way in the first place, and you didn't even think about possibly mentioning how to get around it.

Wow, you just keep going on. If you want to continue this you can create a thread in the drama section to crap on me, but this is not the place for it.

Yeah, thats even less help than me commenting on how appetizing the thought of a melon was. Thats just going to break brick planting on his server. If you don't even understand basic scripting I can't imagine why you keep posting here misleading and misinforming people.
Whoops, forgot to add that it must be in a package, soz.

Thanks these are relay useful, and don't worry I have plenty do do even if you do give me a code that works just the way I want it to. (which none of you have given me) :D

Wow, you just keep going on. If you want to continue this you can create a thread in the drama section to crap on me, but this is not the place for it.
Well, here ya go: http://forum.blockland.us/index.php?topic=49374.0

What could probably be used to solve the brick planting problem:
- Before placing, check if they have enough money to place it
- If they do not, do not plant the brick and show an error
- Plant the brick and schedule a 'check' function 10-100ms after for the brick
- If the brick does not exist due a planting error or trust, do nothing - don't charge them
- Check if they still have enough money to place it (e.g. they used a script to try and break it by buying something in that 10-100ms)
- If they do not, kill the brick and show an error
- If they do, charge them that amount of money and show some sort of indicator that it cost you that amount of money

This method would make "running out of money" appear in the same way as other brick planting errors such as "Overlap" and "Float".What could probably be used to solve the brick planting problem:
- Before placing, check if they have enough money to place it
- If they do not, do not plant the brick and show an error
- Plant the brick and schedule a 'check' function 10-100ms after for the brick
- If the brick does not exist due a planting error or trust, do nothing - don't charge them
- Check if they still have enough money to place it (e.g. they used a script to try and break it by buying something in that 10-100ms)
- If they do not, kill the brick and show an error
- If they do, charge them that amount of money and show some sort of indicator that it cost you that amount of money

This method would make "running out of money" appear in the same way as other brick planting errors such as "Overlap" and "Float". You could actually use the "Limit" brick plant error which usually only appears in Demo mode to make it look nicer. (as well as a message "You don't have enough money...")


(By the way, why is the "Team" plant error gone? For some reason, the image is still under "small" plant errors but it's gone for the normal size)
« Last Edit: November 02, 2008, 03:34:19 AM by Space Guy »