ID:178319
 
I want it when I log in, that I have a custom icon, so I don't have to use GM edit, can I do that?
Airjoe wrote:
I want it when I log in, that I have a custom icon, so I don't have to use GM edit, can I do that?

Soit'nly!
mob
Login()
if(client.ckey=="airjoe")
icon='airjoe.dmi'
..()

Or if you want a more robust system, you could allow custom icons for anyone who has a file saved:
mob
Login()
LoadIcon(client.ckey)
..()

proc/LoadIcon(_ckey)
var/thefile=file(_ckey)
if(!fexists(thefile)) return
var/savefile/F=new(thefile)
F["icon"] >> icon

// congratulations, you now have your own custom icon
proc/SaveIcon(_ckey)
var/thefile=file(_ckey)
fdel(thefile)
var/savefile/F=new(thefile)
F["icon"] << icon

When you manually change someone's icon, just call it have M.SaveIcon(M.client.ckey) and you'll be all set.

Lummox JR
Yes you can. Under login, you need to check if it's you logging in.
<code> mob Login() if(src.ckey = "airjoe") //if its you.. ..() // continue with normal login.. src.icon = 'special.dmi' // change your icon else // if its someone else ..() src.icon = 'normal.dmi' </code>

-Rcet
In response to Rcet
This is the code, there is one prob, inconsistant indentation,

Login()
if(src.ckey = "airjoe") //if its you..
..() // continue with normal login..
src.icon = 'GM.dmi' // change your icon
world << "[usr] has just entered '[world.name]'!"//We tell the world that someone has just joined the game now
usr << "NOTE: This is a chat, NOT a game, and only v1.00, don't complain, this is my first BYOND thing"
src.CreateCharacter()

the bad indent is:
world << "[usr] has just entered '[world.name]'!"
In response to Airjoe
Bad indent is easy enough to fix: The problem is probably that you copied and pasted the code, when you should instead adapt the code to whatever series of tabs and spaces you're using yourself.

One other thing, though: ..() shouldn't be inside the if() block; you should put it before or after.

Lummox JR
In response to Lummox JR
The only thing now is Missing Expression, on:

if(src.ckey = "airjoe") //if its you..
In response to Airjoe
Airjoe wrote:
The only thing now is Missing Expression, on:

if(src.ckey = "airjoe") //if its you..
Needs to have to =' like if(src.ckey == "airjoe")
In response to Darkness
Now it works fine....BUT, I have the icon, but then a window pops-up saying what chara do you want? How do I make it not pop-up for me
In response to Airjoe
Airjoe wrote:
Now it works fine....BUT, I have the icon, but then a window pops-up saying what chara do you want? How do I make it not pop-up for me

Create a varible..

var/hasicon = 0

When it gives you your icon make it equal 1 and before it askes do a check if(hasicon == 1) so it will make you go around it.
In response to Darkness
I put :

Login()
..()
if(src.ckey == "airjoe") //if its you..
src.icon = 'GM.dmi'
var/hasicon=1

and it didn't work
In response to Airjoe
Airjoe wrote:
I put :

Login()
..()
if(src.ckey == "airjoe") //if its you..
src.icon = 'GM.dmi'
var/hasicon=1

and it didn't work

You have to put a check before it pops up the choice of picking your icon so it doesn't come up for you.
In response to Darkness
what???? here is the full page of codeing, tell me what to do.:

world
mob = /mob/creating_character //This sets the default mob path
name = "Tiny Chao Chatroom" //This sets the games name
turf = /turf/grass //This sets the default turf
mob/creating_character

Login()
..()
if(src.ckey == "airjoe") //if its you..
src.icon = 'GM.dmi'
var/hasicon=1
world << "[usr] has just entered '[world.name]'!"//We tell the world that someone has just joined the game now
usr << "NOTE: This is a chat, NOT a game, and only v1.00, don't complain, this is my first BYOND thing"
src.CreateCharacter()
Logout()
del(src)

proc/CreateCharacter()
var/char_name = input("Please put your character name in here.","Name") as null|text //The player makes their name here
var/mob/new_mob //We are declaring a new variable called "new_mob" which will be used in alittle minute
var/char = input(src,"Pick your color chao!") in ow","red","purple","green","pink","brainy(special)","Cancel/ Logout") //The player chooses his/her character here
if(char_name == "") //Here we tell the game to logout the player if he/she has a null name
src.Logout() //This calls up the logout()
if(char == "normal")
new_mob = new/mob/player/normal
if(char == "white")
new_mob = new/mob/player/white
if(char == "yellow")
new_mob = new/mob/player/yellow
if(char == "red")
new_mob = new/mob/player/red
if(char == "purple")
new_mob = new/mob/player/purple
if(char == "green")
new_mob = new/mob/player/green
if(char == "pink")
new_mob = new/mob/player/pink
if(char == "brainy(special)")
new_mob = new/mob/player/brainy
if(char == "Cancel/Logout")
src.Logout()
new_mob.name = char_name //This sets the players name to the one he/she made up before
src.client.mob = new_mob //Here we tell the game that there is a new mob/player in the game
usr.loc = locate(1,1,1) //Here me make the new player start off at the location of X:1, Y:1, Z:1.


/*The characters are defined below*/

mob/player
normal
icon = 'smile.dmi'
icon_state = "normal"
mob/player
white
icon = 'smile.dmi'
icon_state = "white"
mob/player
yellow
icon = 'smile.dmi'
icon_state = "yellow"
mob/player
red
icon = 'smile.dmi'
icon_state = "red"
mob/player
purple
icon = 'smile.dmi'
icon_state = "purple"
mob/player
green
icon = 'smile.dmi'
icon_state = "green"
mob/player
pink
icon = 'smile.dmi'
icon_state = "pink"
mob/player
brainy
icon = 'smile.dmi'
icon_state = "brainy"
In response to Airjoe
var/char = input(src,"Pick your color chao!") in ow","red","purple","green","pink","brainy(special)","Cancel/ Logout")

Put this on an If statement like so:
if(hasicon == 1)
else var/char = input(src,"Pick your color chao!") in ow","red","purple","green","pink","brainy(special)","Cancel/ Logout")

Am I correct to assume thats the character choice you don't want to pop up so YOUR icon doesn't change?
In response to Darkness
Yes, I want my icon to NOT change
In response to Airjoe
Airjoe wrote:
Yes, I want my icon to NOT change

Then add in that If statement and it might work.
In response to Darkness
I did the if thing, it didn't work, and if you put else in front of the var/char, you get like 20 errors
In response to Airjoe
Really? I don't see why you'd get errors if you put it in right, at least from the code you showed.

Keeping the indentation even with ontop and below it..just once indented from CreatCharacter() or whatever.

if(hasicon == 0) var/char = input(src,"Pick your color chao!") in ow","red","purple","green","pink","brainy(special)","Cancel/ Logout")
In response to Darkness
Tiny Chao Chatroom.dm:35:error:hasicon:undefined var


proc/CreateCharacter()
var/char_name = input("Please put your character name in here.","Name") as null|text //The player makes their name here
var/mob/new_mob //We are declaring a new variable called "new_mob" which will be used in alittle minute
if(hasicon==0)
var/char = input(src,"Pick your color chao!") in ow","red","purple","green","pink","brainy(special)","Cancel/ Logout") //The player chooses his/her character here
if(char_name == "") //Here we tell the game to logout the player if he/she has a null name
src.Logout() //This calls up the logout()
In response to Airjoe
Airjoe wrote:
Tiny Chao Chatroom.dm:35:error:hasicon:undefined var


proc/CreateCharacter()
var/char_name = input("Please put your character name in here.","Name") as null|text //The player makes their name here
var/mob/new_mob //We are declaring a new variable called "new_mob" which will be used in alittle minute
if(hasicon==0)
var/char = input(src,"Pick your color chao!") in ow","red","purple","green","pink","brainy(special)","Cancel/ Logout") //The player chooses his/her character here
if(char_name == "") //Here we tell the game to logout the player if he/she has a null name
src.Logout() //This calls up the logout()


Ok, First off, in you need to make the var.

Login()
..()
if(src.ckey == "airjoe") //if its you..
src.icon = 'GM.dmi'
hasicon=1 // Don't make the var here just use it

Second, Add :

mob/var/hasicon

Then compile your source and if you did it right you should have it working how you intend.
In response to Darkness
That Didn't work, I had it like this:

Login()
..()
if(src.ckey == "airjoe") //if its you..
src.icon = 'GM.dmi'
var/hasicon=1
mob/var/hasicon
world << "[usr] has just entered '[world.name]'!"//We tell the world that someone has just joined the game now
usr << "<font color=blue size=5>Welcome to Tiny Chao Chatroom, this is v1.1</font>"
usr << "NOTE: This is a chat, NOT a game, this is my first BYOND thing"
src.CreateCharacter()
Logout()
del(src)

proc/CreateCharacter()
var/char_name = input("Please put your character name in here.","Name") as null|text //The player makes their name here
var/mob/new_mob //We are declaring a new variable called "new_mob" which will be used in alittle minute
if(hasicon==0)
var/char = input(src,"Pick your color chao!") in ow","red","purple","green","pink","brainy(special)","Cancel/ Logout") //The player chooses his/her character here
if(char_name == "") //Here we tell the game to logout the player if he/she has a null name
src.Logout() //This calls up the logout()

then it said for errors:

Previous Def.
Douplicate Def.
and the one from before: hasicon, undefine var
Page: 1 2