ID:167397
 
here is the code
Fly()
set category = "Admin"
if(!fly){density=0;usr<<"You begin to fly.";fly++}
else {density=1;usr<<"You land on the ground.";fly--}


mob/var/fly

the icons i am using are

mob.dmi
&
testmob.dmi
The topic is called "How would i change this icon.........................." but there is no icon to change
In response to A.T.H.K
yes i did i gave my icon its the mob one and i need to change it to testmob
In response to Mxjerrett
He means that there isn't an icon defined in the code snippet given.
In response to Pyro_dragons
well i cant really do much there accept show you my icon code.
mob
Login()
if(usr.key=="Mxjerrett")
icon = 'mob.dmi'
usr.verbs += typesof(/mob/Admin/verb/)
else
icon = 'man.dmi'
mob/verb/Fly()
var/fly=0
var/originalicon
set category = "Admin"

if(!fly)
density=0
usr<<"You begin to fly."
fly=1
originalicon= icon//sets the variable for originalicon to equal what the icon was before taking flight for later recall
icon= "testmob.dmi"//changes icon to testmob.dmi
else
density=1
usr<<"You land on the ground."
fly=0
icon= originalicon// recalls the original icon

Is this what you wanted to do? It should work but I haven't tested it.
In response to Kireis
its kinda choppy but i altered the code to this

Fly()
set category = "Admin"
if(!fly){density=0;usr<<"You begin to fly.";fly=1;originalicon= icon;icon = 'testmob.dmi'}
else {density=1;usr<<"You land on the ground.";fly=0;src.icon= originalicon}


var/originalicon
mob/var/fly=0
</dm?
In response to Mxjerrett
I don't mean to try to tell you how you should code your own work but it appears to me that you are just getting familiar with the DM language. I'd reccomend that you start out with formatting your code the way I showed you. You should put the proc definitions on seperate lines instead of using semicolons and keeping them on the same line. It's easier on the eyes and allows beginners to grasp the concept of what belongs inside what. It just seems like a more organized way to code to me. Also I recommend that you define the variables originalicon and fly inside the proc instead of at a global scope. That is, unless you use those variables outside of the proc, but i doubt it.
In response to Kireis
MxJerret, REALLY now, stop copy/pasting off forums, stop the user abuse, and read the DM guide. This has gone outrageous!

What was the previous guy's name? Vegeto or something? Vejito? o.o
In response to Mysame
Mysame wrote:
What was the previous guy's name? Vegeto or something? Vejito? o.o

Do you mean Govegtos? =/

O-matic
In response to O-matic
YES! That's the one! Govegtos!
In response to Mxjerrett
Mxjerrett wrote:
well i cant really do much there accept show you my icon code.
> mob
> Login()
> if(usr.key=="Mxjerrett")
> icon = 'mob.dmi'
> usr.verbs += typesof(/mob/Admin/verb/)
> else
> icon = 'man.dmi'
>


Firstly, you need to call the parent in mob/Login(). Else Login() will never finish properly. Also, using usr in a Login() proc is a big no-no. You might find reading the UsrLecture usefull.

And can you give a better explanation of what you're wanting to do? I don't understand a thing...

O-matic
Mxjerrett wrote:
here is the code
> Fly()
> set category = "Admin"
> if(!fly){density=0;usr<<"You begin to fly.";fly++}
> else {density=1;usr<<"You land on the ground.";fly--}
>
>
> mob/var/fly
>
>
>

the icons i am using are

mob.dmi
&
testmob.dmi

It'd be nice if you gave me a credit for my code next time...
Don't copy from examples, learn from them. Bah.
As for changing icons, just add ;icon='icon.dmi' or somthing.
In response to Kireis
um i tried to do it this way
            Fly()
set category = "Admin"
if(!fly){density=0;usr<<"You begin to fly.";fly++}
originalicon= icon;icon = 'testmob.dmi'
else {density=1;usr<<"You land on the ground.";fly--}
src.icon= originalicon

but i get this error can someone help fix it

loading The Last Hero.dme
code files\admin.dm:50:error::invalid expression
code files\admin.dm:51:error:else :'else' clause without preceding 'if' statement
code files\admin.dm:52:error::missing expression

The Last Hero.dmb - 3 errors, 0 warnings (double-click on an error to jump to it)
In response to Mxjerrett
Well it might be because you have to put the code in the {}



    Fly()
set category = "Admin"
if(!fly){density=0;usr<<"You begin to fly.";fly++;originalicon= icon;icon = 'testmob.dmi'} else {density=1;usr<<"You land on the ground.";fly--;src.icon= originalicon}


Please don't copy and paste your not learning much i only did it to show you what you have to do and PLEASE PRETTY PLEASE stop taking credity for everything that isn't yours andi doubt you have much of the game your working on its all snippets off the forums READ THE DM guide and REFERENCE please pretty god damn please
mob/admin/verb/Fly()
set category="Admin"
density=!density // Reverse the density.
usr<<"[(!density)?"You begin to fly.":"You land on the ground."]" // Ternary statement based off usr's current density to display proper message.
icon=(!density)?'testmob.dmi':initial(icon) // Ternary statement to determine what usr's icon is set to, if no density then the testmob.dmi icon, or else the initial icon set at compile-time for the mob.