ID:160735
Jul 28 2008, 9:38 am
|
|
okay, i want to make it so when there is a server on my hub on the server it will say "Version 3.5 Host == [Host name here]" but i dont know how to insert the host name.... and i know how to do all the rest of it....
|
In response to K'ros Trikare
|
|
thanks.
|
In response to Kirasu
|
|
There might actually be a problem with the above. world/New() is called when the world is initially loaded, I'm not entirely sure when world.host is set. It might not be until well after world/New() is called, in which case the status would be set to:
"Version 3.5 Host == null" Another way to do it: var/count = 0 |
In response to K'ros Trikare
|
|
I would put that in client/New() :)
Also, did you know about the new variable "host" that came in 4.0? Because the way the snippet is, the host name changes to the last person that logged in. There's always a way to get the player count without having a variable but it's not worth the effort <font size=1>(world.Export("byond://[world.address]:[world.port ]?ping")-1 <-- read up the Default action entry in world.Topic)</font> |
In response to GhostAnime
|
|
GhostAnime wrote:
I would put that in client/New() :) client/New() probably makes more sense. I did know of the world.host variable, reason I didn't use it in this case is because I don't know when world.host is set. And no, that bit where the status is set is called only once. if(!count) checks to see if count = 0 (which it is by default), then adds one to it (if(!count) no longer is true), and sets the status. Edit: client/New() would work. But it would set the end part of that as null until the game is hosted and someone new logs in. |
In response to K'ros Trikare
|
|
Ah, I somehow missed it, though that method would make it so count only raises if it is 0... though you can always have it as
if(!count++)
Since var++ returns the value of var before the addition of one, you can see if it is 0. If it isn't, it'll still add up but won't call the if() block! |
In response to GhostAnime
|
|
okay, i did all this kinda stuff and here is what i have now
world and there is one error it says: Naruto.dm:15:error::expected a constant expression please someone tell me how to fix it... |
In response to Kirasu
|
|
Kirasu wrote:
okay, i did all this kinda stuff and here is what i have now > and there is one error it says: As I said in a previous post, you have to set the status at run time. |
This is pretty self-explanatory.
world |
In response to K'ros Trikare
|
|
K'ros Trikare wrote:
Kirasu wrote: > > and there is one error it says: ROFL And Jemai1 just smoked ya. LOL Still shouldn't it be? world |
In response to Green Lime
|
|
Oh, yea. I forgot the OpenPort() returns a value.
|
In response to Green Lime
|
|
Smoked me?
Limey, thats still @ run time =D. |
I believe you have to do it at run time like this, otherwise an "expected a constant expression" error will be thrown. Someone enlighten me with a better way if it exists.
Edit: Forgot ..()