ID:149265
 
i have a variable named temploc, and when ever you get in battle i have it say "temploc = usr.loc" but at the end of batte when i return it with this code "usr.loc = locate(temploc)" it just gives you a black screen....i have defined it as "var/temploc" but it still just gives me a black screen, can someone help me with this?
Redslash wrote:
i have a variable named temploc, and when ever you get in battle i have it say "temploc = usr.loc" but at the end of batte when i return it with this code "usr.loc = locate(temploc)" it just gives you a black screen....i have defined it as "var/temploc" but it still just gives me a black screen, can someone help me with this?

Since temploc should be a turf, locate(temploc) is wrong; get rid of locate().

Also, you shouldn't be using usr in most (if not all) cases here. Odds are, at the end of the battle usr could be someone else, and at the beginning that could be the case too.
If you're using usr in Entered() to trigger the beginning of the battle, don't. Entered() is not a valid place to use usr. In your battle procs, usr probably isn't any more valid either; you should have a var that keeps track of the mob, and use that instead.

Lummox JR
In response to Lummox JR
im sorry but.. um.. im still mew to this and i have to clue what your talking about... if you cou simplify that, it would help..
In response to Redslash
Redslash wrote:
im sorry but.. um.. im still mew to this and i have to clue what your talking about... if you cou simplify that, it would help..

No put usr in proc. Put usr in verb only. No pull SSGX. Carve wheel with bone. Ungh.

Lummox JR
In response to Lummox JR
umm... why not? the code works perfectly well if i enter a location on the map... i don't see why i have to rewrite he whole code...

ps. whats SSGX?
In response to Redslash
do it like this

before battle

var/tempx = x
var/tempy = y
var/tempz = z

after the battle

usr.locate(tempx,tempy,tempz)

^This might need to be src
In response to Redslash
Redslash wrote:
umm... why not? the code works perfectly well if i enter a location on the map... i don't see why i have to rewrite he whole code...

This will only work in a one-player game, and not well at that. Putting usr in Entered() is probably the single most common blunder I see in BYOND; it should never, ever, ever go there. Entered() takes an atom as an argument--you should be using that instead.

ps. whats SSGX?

Pulling an SSGX is what you're doing with the obnoxious ellipses. Just use periods, unless you have a legitimate reason for trailing off.

Lummox JR
In response to Netshark010101
OMG IT WORKED!!! THANK YOU!!! and no, it didn't need to be src cause src was the enemy!
In response to Lummox JR
Hmm... I knew that entrant worked, but I always thought usr worked the same way. It's always seemed to work for me... is it just a matter of class, or is there actually a difference?
In response to Lord of Water
Lord of Water wrote:
Hmm... I knew that entrant worked, but I always thought usr worked the same way. It's always seemed to work for me... is it just a matter of class, or is there actually a difference?

There's absolutely a difference. Any time Move() is called, the associated procs will be called, whether Move() was ultimately called by a client proc (acting as a verb) or not. Thus, you can't rely on usr to be correct.

Even if it was reliable, it's extremely bad form. Using usr outside of verbs is like praying for disaster.

Lummox JR