ID:180234
 
Greetings. I just need this quick question answered:

How do I have it so a object is located to a random (x,y,z)
I have this so far:

O.loc=locate()

what would I put in the ()'s?

I've also tried things like:
(random.x,random.y,random.z)
but that doesnt seem to work

Please help
On 8/5/01 6:39 pm Dracon wrote:
Greetings. I just need this quick question answered:

How do I have it so a object is located to a random (x,y,z)
I have this so far:

O.loc=locate()

what would I put in the ()'s?
Did you press F1 in DM to check the use of locate?
In response to sunzoner
Ok. I did that. I have this:

randx = rand(1,300)
randy = rand(1,300)


but It gives me these errors when I compile:

battle_system.dm:5:error:= :expected a constant expression
battle_system.dm:6:error:= :expected a constant expression

PLEASE HELP

In response to Dracon
On 8/5/01 7:34 pm Dracon wrote:
Ok. I did that. I have this:

randx = rand(1,300)
randy = rand(1,300)


but It gives me these errors when I compile:

battle_system.dm:5:error:= :expected a constant expression
battle_system.dm:6:error:= :expected a constant expression

PLEASE HELP

Evidently, you're trying to do this outside of a proc. You can't have code that does ANYTHING, unless it's located inside a procedure. Otherwise, how will the computer know when it's supposed to run the code?
In response to LexyBitch
On 8/5/01 7:39 pm LexyBitch wrote:
On 8/5/01 7:34 pm Dracon wrote:
Ok. I did that. I have this:

randx = rand(1,300)
randy = rand(1,300)


but It gives me these errors when I compile:

battle_system.dm:5:error:= :expected a constant expression
battle_system.dm:6:error:= :expected a constant expression

PLEASE HELP

Evidently, you're trying to do this outside of a proc. You can't have code that does ANYTHING, unless it's located inside a procedure. Otherwise, how will the computer know when it's supposed to run the code?

How would I have it inside a proc then? What code would I put? I just have this so far and the same errors show up:

obj
var
randx=rand(1,300)
In response to Dracon
On 8/5/01 7:42 pm Dracon wrote:
How would I have it inside a proc then? What code would I put? I just have this so far and the same errors show up:

obj
var
randx=rand(1,300)

You need to step back and start from the beginning. To do so, you should follow the steps outlined in the Getting Started part of the FAQ.

This will point you to tutorials and source code you can use to learn.

Until you learn the basics, you are not going to get anywhere...

Here is the Getting Started section:

http://www.deadron.com/Admin/BYOND_FAQ.html#getting-started