ID:148504
 
Ok. Well, what I want to do is when someone logs in. They will get host powers. And then it adds to the amount of people in the world. And then it locates them. I tried locating them using X,Y,Z , and using an area/turf. But whenver they person logs in, all I get is a blank screen. And I don't get host powers. Now this is really strange to me because it worked or me before. But I'll just shut up and let you see the code.

mob/Login()
if(people
if(people==0)//if your the first person
usr<<"You are the host!"//Tell's the usr that they are the host
usr.loc=locate(/turf/Start)
people+=1//adds one person to the var "people"
usr.verbs.Add(/mob/Host/verb/Host_Boot)//adds the host verb Host Boot
usr.verbs.Add(/mob/Host/verb/Set_Player_Cap)
usr.verbs.Add(/mob/Host/verb/Host_Boot)//add the summon verb
usr.verbs.Add(/mob/Host/verb/Mute)//add the summon all command
usr.verbs.Add(/mob/Host/verb/Unmute)//add the Condemn command
HOST=usr.key//the host is the uset
usr.verbs.Add(/mob/Host/verb/Reboot)
usr.verbs.Add(/mob/Host/verb/Ban)
usr.verbs.Add(/mob/Host/verb/Unban)
world.name="Carnage Revolution: [HOST]'s server, 1 person online"//sets up the worlds name to Host people control: the worlds host, 1 person online
else//if they arn't the first person1
usr<<"Welcome to [world.name]!"//welcome them to your game
usr.loc=locate(/turf/Start)
people+=1//adds one to the "people" var
world.name="Host Demo and People Control: Hosted by [HOST], [people] people online"//since there is more than person you hve to tell how many people
else
usr<<"There are too many people come back later!"//tell's the usr that there are too many people and for them to come back later
del(src)//deletes the user

mob/Logout()//when someone logs out
people-=1//subtract that person
del(src)//delete his icon
if(people==1)//if there is only 1 person left in the game
world.name="Carnage Revolution: [HOST]'s server, 1 person online"//changes the worlds name
else
world.name="Carnage Revolution: [HOST]'s server, [people] people online"//changed the worlds name again...

Ignore the comments. As I went through lots of demos and libraries to try and get it to work. -.-
There are a lot of oddities in there. Among them, you've repeated the loc=locate(...) code twice, as well as the people+=1 line. (BTW, the ++ operator is just as good, and this would actually be much better done with a list of players instead of just a head count.)

Also a big one is that usr is repeated ad nauseum in Login(). Now this isn't a big deal in Login() much of the time, but src is always correct so you should just use that.

Another strange bit is that you put del(src) in too soon in your Logout() proc. As should be obvious, none of the code after that will run.

Lummox JR
In response to Lummox JR (#1)
Ah. I see now. I thought I took out the extra locate lines. Hmm... Thanks for the help Lummox JR! Imma' go try it out now =)
In response to GoodDoggyTreat (#2)
GoodDoggyTreat wrote:
Ah. I see now. I thought I took out the extra locate lines. Hmm... Thanks for the help Lummox JR! Imma' go try it out now =)

The problem isn't that there are extra; it's that you've got them done in both the if and the else sections; it's redundant. Any code that should be done whether the player is the host or not should be done either before or after that if() block. What you're basically doing is like this:
if(c)
a=1
b=2
else
a=1
instead of this:
a=1
if(c)
b=2

Lummox JR
In response to Lummox JR (#3)
Oh!! That makes more sense to me now. That way it would locate them either way. But still , for some strange reson, it's still not working.Because whenI ran it, I still got a blank screen. So I decided to make a verb called Join. And when I used the verb. It took me to /turf/Start. So I'm stumped on how if it work's in a verb. How doesnt it work in the proc?

-GDT
In response to GoodDoggyTreat (#4)
GoodDoggyTreat wrote:
Oh!! That makes more sense to me now. That way it would locate them either way. But still , for some strange reson, it's still not working.Because whenI ran it, I still got a blank screen. So I decided to make a verb called Join. And when I used the verb. It took me to /turf/Start. So I'm stumped on how if it work's in a verb. How doesnt it work in the proc?

I'm a little unsure on this myself. Does the /turf/Start actually exist during the initial login?

If you were using Move(), I could see a problem because the turf could always be blocked--but you're not. Setting it directly should work if the turf exists.

Lummox JR
In response to Lummox JR (#5)
Yea Im using the turf. Its on the map too. I tried it before using an area. I got run time errors I think. So I used a turf instead. And now, wierdest of all. I still dont even get the host verbs. This is creeping me out because it usually doesn't happen to me. -.-
In response to GoodDoggyTreat (#6)
Your gonna kick yourself if this works, but I think you need
..()
at the end of your login proc. You know to tell it to continue the regular login proc.
Just a side note on the method you're using to figure out the host: I've been told that if the host reboots that it is very possible that he/she isn't the fisrt to actually log in. (Odd to me) So just choosing the first person doesn't actually work I think, there may be a demo or two that could explain this. (I think it's something like checking the address of the world with the clients. (if(world.address == client.address) ) I just tryed that and for some reason client.address is either "" or null? (I did a world << client.address in the login and got nothing. )

-<font color="ffdddd">Nova</font>
In response to Jnco904 (#7)
Jnco904 wrote:
Your gonna kick yourself if this works, but I think you need
..()
at the end of your login proc. You know to tell it to continue the regular login proc.

Since he's setting loc manually, that shouldn't really matter.

Lummox JR
In response to Lummox JR (#9)
hmm, I guess that's right, but is there anything else that the normal login proc does? sorry I'm kind of new to this and had a problem just like it. :)
In response to Lummox JR (#9)
Yep. I tried that a bunch of times. Never worked, not even once. But I still don't know if a verb works. But not the proc..
In response to Jnco904 (#10)
The normal login proc usually teleports you to the empty space hat is nearest to 1,1,1. So if you were to log in. Youd end up at 1,1,1 or somehwere around there.
In response to GoodDoggyTreat (#12)
ok, thanks.