ID:150731
 
This gives me the error, invalid expression..
crawl()
set category = "Commands"
icon = 'crawl.dmi'
if(icon == 'crawl.dmi')
icon = 'blue.dmi'

If a player hits crawl, then it changes their icon to crawl.dmi, if they hit it again it changes it back to their original icon..
On 8/4/01 2:16 pm Oblivian wrote:
This gives me the error, invalid expression..
crawl()
set category = "Commands"
icon = 'crawl.dmi'
if(icon == 'crawl.dmi')
icon = 'blue.dmi'

If a player hits crawl, then it changes their icon to crawl.dmi, if they hit it again it changes it back to their original icon..

Two problems. One is that you're indenting your if. If you unindent that, your code will be error free, but meaningless. Why? Look at the instructions you're giving the computer:

"Change my icon to crawl."
"Check to see if my icon is crawl."
"If it is crawl, change it back."

The computer will execute those steps, in exactly the same order you give them to it. So, when you run the verb, here is what the computer will do:

1. Change your icon to crawl.
2. Check and see if your icon is crawl.
3. Conclude that it is... after all, it just set it to crawl, didn't it?
4. Change the icon back.
In response to LexyBitch
On 8/4/01 2:19 pm LexyBitch wrote:
On 8/4/01 2:16 pm Oblivian wrote:
This gives me the error, invalid expression..
crawl()
set category = "Commands"
icon = 'crawl.dmi'
if(icon == 'crawl.dmi')
icon = 'blue.dmi'

If a player hits crawl, then it changes their icon to crawl.dmi, if they hit it again it changes it back to their original icon..

Two problems. One is that you're indenting your if. If you unindent that, your code will be error free, but meaningless. Why? Look at the instructions you're giving the computer:

"Change my icon to crawl."
"Check to see if my icon is crawl."
"If it is crawl, change it back."

The computer will execute those steps, in exactly the same order you give them to it. So, when you run the verb, here is what the computer will do:

1. Change your icon to crawl.
2. Check and see if your icon is crawl.
3. Conclude that it is... after all, it just set it to crawl, didn't it?
4. Change the icon back.

Oh, i see.. then what do I use to get it work? I tried 2 different ways. The other way was sticking another verb in after crawl is activated, but I don't think you can have a verb inside a verb.
In response to Oblivian
On 8/4/01 2:23 pm Oblivian wrote:
On 8/4/01 2:19 pm LexyBitch wrote:
On 8/4/01 2:16 pm Oblivian wrote:
This gives me the error, invalid expression..
crawl()
set category = "Commands"
icon = 'crawl.dmi'
if(icon == 'crawl.dmi')
icon = 'blue.dmi'

If a player hits crawl, then it changes their icon to crawl.dmi, if they hit it again it changes it back to their original icon..

Two problems. One is that you're indenting your if. If you unindent that, your code will be error free, but meaningless. Why? Look at the instructions you're giving the computer:

"Change my icon to crawl."
"Check to see if my icon is crawl."
"If it is crawl, change it back."

The computer will execute those steps, in exactly the same order you give them to it. So, when you run the verb, here is what the computer will do:

1. Change your icon to crawl.
2. Check and see if your icon is crawl.
3. Conclude that it is... after all, it just set it to crawl, didn't it?
4. Change the icon back.

Oh, i see.. then what do I use to get it work? I tried 2 different ways. The other way was sticking another verb in after crawl is activated, but I don't think you can have a verb inside a verb.

Well, you want it to do one thing if your icon is crawl and one thing if it isn't... don't you think you should check the icon first?
In response to LexyBitch
On 8/4/01 2:33 pm LexyBitch wrote:
On 8/4/01 2:23 pm Oblivian wrote:
On 8/4/01 2:19 pm LexyBitch wrote:
On 8/4/01 2:16 pm Oblivian wrote:
This gives me the error, invalid expression..
crawl()
set category = "Commands"
icon = 'crawl.dmi'
if(icon == 'crawl.dmi')
icon = 'blue.dmi'

If a player hits crawl, then it changes their icon to crawl.dmi, if they hit it again it changes it back to their original icon..

Two problems. One is that you're indenting your if. If you unindent that, your code will be error free, but meaningless. Why? Look at the instructions you're giving the computer:

"Change my icon to crawl."
"Check to see if my icon is crawl."
"If it is crawl, change it back."

The computer will execute those steps, in exactly the same order you give them to it. So, when you run the verb, here is what the computer will do:

1. Change your icon to crawl.
2. Check and see if your icon is crawl.
3. Conclude that it is... after all, it just set it to crawl, didn't it?
4. Change the icon back.

Oh, i see.. then what do I use to get it work? I tried 2 different ways. The other way was sticking another verb in after crawl is activated, but I don't think you can have a verb inside a verb.

Well, you want it to do one thing if your icon is crawl and one thing if it isn't... don't you think you should check the icon first</B

woot got it to work :) thanx for your help lexy.