ID:165516
 
Even with no errors or anything, I can't log in. I can't seem to figure out why. Is there anything in this code stoping me from logging in?

mob
Login()
world<<"<b>[src.name] has logged in.</b>"
src.icon = 'Plain char.dmi'
src.loc = locate(5,5,1)
..()
turf
start
mob
proc
shoot()
var/obj/bullet/F = new/obj/bullet
var/mob/M
new/obj/bullet
for(M in view()||null)
if(M == usr) continue
if(null) return "There are no targets around"
while(F)
step(F,M.loc)
if(F.loc == M.loc)
world<<"You hit him"
del F
del M

obj
bullet
icon = 'bullet.dmi'
turf
ground
icon = 'dirt.dmi'
mob
dummy
icon = 'Plain char.dmi'
mob
verb
Shoot()
shoot()
Don't use usr in a proc.
In response to Xx Dark Wizard xX
That doesn't fix the problem you know.
In response to Speedro
You are also using the || operator incorrectly.
In response to Speedro
You'd be surprised at how it actually does in the long run... do you have another other Login() called somewhere else in the program which has been overwritten?

- GhostAnime
In response to GhostAnime
I just started the game, that's all there is to it..

Rather than just elling me i'm using || wrong, could you tell me how i'm using it wrong?
In response to Speedro
Oh, and when I log in, it says [key]Guest at the bottom rather than "logging in"
In response to Speedro
Speedro wrote:
Oh, and when I log in, it says [key]Guest at the bottom rather than "logging in"

That means that your Dream Seeker is having trouble contacting the BYOND Pager to log in your key. Could you please make a thorough post in Bug Reports about this? Also, in Dream Seeker, type in ".configure debug on" so that DS will show the debugging info for connecting to the pager. When you try to log in, but it doesn't work, copy & paste that debugging info and put it with the Bug Report so that the BYOND Staff can try to fix it.
In response to Jon88
Fixed, just wasn't signed into byond.
In response to Speedro
Infinite loop suspected--switching proc to background.
If it is not an infinite loop, either do 'set background=1' or set world.loop_checks=0.
proc name: shoot (/mob/proc/shoot)
usr: Speedro (/mob)
src: Speedro (/mob)
call stack:
Speedro (/mob): shoot()
Speedro (/mob): Shoot()


Umm?
In response to Speedro
That's because of your broken ||.

mob
proc
shoot()
var/obj/bullet/F = new/obj/bullet
var/mob/M
new/obj/bullet
for(M in view())
if(M==usr) continue //don't select the player as a possible target
break
if(M) //we got a target
var/recursion=0 //protection against an infinite loop
while(M&&(M in view())&&!(M in F.loc)) //while we do have a target (player hasn't logged out or anything) and it's within range AND the bullet hasn't hit the target
step_towards(F,M,0) //let the bullet go towards the target
recursion++
if(recursion>=10) M=null //bullets may travel up to 10 tiles before getting deleted. This is simple protection so that i.e. the bullet can't get stuck against a dense object
sleep(1) //small delay for the bullet so it can't ever run an infinite loop
if(M.loc==F.loc)
src<<"You have hit [M.name]!" //use M.name in favor of M directly for mobs: this will treat it as a proper word (and no "the" comes in front of the name when the first letter is lowercase)
F.loc=null //alternative to deletion just for the sake of showing it: when the proc ends "F" is no longer a reference to the bullet. With the bullets' location at null and no other references to it, the garbage collection program will automatically delete the bullet for you. However, it does allow any running procs to finish. Use it carefully, any reference will keep it alive, including two variables of two objects pointing to eachother.
del M //probably bad for your players, but I'm not the one to judge
else src<<"There are no targets within sight."