ID:168782
Aug 27 2005, 7:04 pm
|
|
In my teleport verb i wanted to make sure it doesnt go past the "Void" turfs but i have no idea how i would look for the Highest X Void and Farthest Y Void. I hope that made sense.
|
In response to Flame Sage
|
|
Im trying to make it teleport you to a random spot aslong as its not Dense but its not working.
mob |
In response to Turles9000
|
|
Turles9000 wrote:
Im trying to make it teleport you to a random spot aslong as its not Dense but its not working. > mob Well that's hardly a surprise, since nothing in that code functions correctly. Let's go over the works:
|
In response to Lummox JR
|
|
k i fixed some problems but i have 2 new ones. I used goto and i read earlier thats not the best way to solve a problem. And i dont know how to check if the location is dense.
mob |
In response to Turles9000
|
|
Turles9000 wrote:
k i fixed some problems but i have 2 new ones. I used goto and i read earlier thats not the best way to solve a problem. Indeed, it's not any way you should be solving your problem. Look up while() instead. What you really need here is a do-while loop. Look up do as well. Never ever use goto unless it's a loop so complex as to defy any other option. And i dont know how to check if the location is dense. The density variable would likely have something to do with it. Lummox JR |
In response to Lummox JR
|
|
but i cant use .density since i guess variables cant have density??
Spells.dm:62:error:TeleportX.density:undefined var Spells.dm:62:error:TeleportY.density:undefined var Spells.dm:62:error:TeleportZ.density:undefined var |
In response to Turles9000
|
|
maybe....TeleportX.turf.density?
|
In response to Nukes4U
|
|
Loop through the atoms in the location using for(), and if you find a dense atom, use a while() loop to go back and reset the random number generators. Otherwise, you could use a do while loop, but I have no clue how to do so. I'm... explaining my example.
mob/verb/Teleport() |
In response to Nukes4U
|
|
Nukes4U wrote:
maybe....TeleportX.turf.density? Ouch. Not even anywhere near correct. Don't just spout random stuff. Lummox JR |
In response to Turles9000
|
|
Turles9000 wrote:
but i cant use .density since i guess variables cant have density?? Well it's not as if you're supposed to check the density of those. Those are numbers; of course they don't have density. I said check the density of the turf. Now let's see, how would you find the turf? Maybe with that little locate() command that was already in there. It's important to read over these things in detail, because it could not have been more clear. It sounds like you're just trying to add stuff in more or less arbitrary spots and seeing if it works, without even trying to understand. If you'd been thinking through this code at all, the if() you were using with !TeleportX and so on would never have been used, nor would you have tried to check the density of a number. This code is failing because you're not trying to make it work; you're just throwing stuff at it to see what sticks. Programming doesn't work that way. Read through, follow the flow. Know which var is which and what type of value you can expect it to have. Lummox JR |
In response to Lummox JR
|
|
Lummox JR wrote:
Nukes4U wrote: Sorreh, i made that post really late =P |
In response to Lummox JR
|
|
ive honestly been trying really hard to get this to work. Here's how i think this code works but its teleporting me to the wrong spot.I tried looking up while and do but i dont understand how it works. Here's what i have so far and how i think it works. I Thought i understood this code but since its not working i obviously dont.
mob |
In response to Turles9000
|
|
Turles9000 wrote:
ive honestly been trying really hard to get this to work. Here's how i think this code works but its teleporting me to the wrong spot.I tried looking up while and do but i dont understand how it works. Well, using goto is not an acceptable substitute for not understanding while(). In fact, there's no acceptable subsitute at all. You need to learn while(). Do not use goto except in loops so complex that, frankly, you will never encounter them. Lummox JR |
Im 99% sure this also checks for void boundries.
If you want to make sure you're not landing on a dense turf, you can just do:
if(!Thing)
i believe that would work.