ID:263685
 
This Problem has been solved.



Message in Reply by Foster Aj:

Update: The density = !density also does not work.

It's not my BYOND or DM, as this same function works on other games.


Message in Reply by Foster Aj:

In a vast reply to all of your overnight comments:

1. Yes it should work, no it does not, and yes the wall density is normal.

2. If you have an attitude, get off my thread.

3. Thanks for the boolean idea, I'll try that.

4. I've done usr, src, and blank.

5. YES BRILLIANT GENIUS, I GIVE THE VERBS.

Edit: 6. I use the verb (my mouse works by the way) and I still bump everything.

Anything else?


Code:
mob
GameMaster
verb
Density_Yes()
set category = "Abilities"
density = 1

Density_No()
set category = "Abilities"
density = 0


Problem description:

The Code compiles fine, but does not work at runtime. The DM guide uses the exact same coding (just different names) so I can't figure out why it will not change the character's density.
mob
GameMaster
verb
Density_Yes()
set category = "Abilities"
src.density = 1

Density_No()
set category = "Abilities"
src.density = 0


That should work.
In response to DadGun
There is no difference... if the typecasting is missing (dunno what it is actually called), it is defaulted to src.__ so density=0 is assumed as src.density=0 already by the DM [at least from what I heard]

And what exactly doesn't work AJ? It seems to work alright (though you could have used boolean to have it set in one verb with notification in two lines)
heres my pitch at it..

mob
GameMaster
verb
Density_Yes()
set category = "Abilities"
usr.density = 1

Density_No()
set category = "Abilities"
usr.density = 0


Try that =/
In response to Learned
Learned wrote:
heres my pitch at it..

> mob
> GameMaster
> verb
> Density_Yes()
> set category = "Abilities"
> usr.density = 1
>
> Density_No()
> set category = "Abilities"
> usr.density = 0
>

Try that =/

There's nothing wrong with the code in the first place. Adding src does exactly the same thing, and adding usr makes it even worse because it really should be src.
There's nothing wrong with the code you posted here.

Could it possibly be that your walls are using something besides density, perhaps overriding turf/Enter()?
In response to Foomer
It's probably because he forgot to actually give the mob the verbs?
mob
GameMaster
verb
Density_Toggle()
set category = "Abilities"
density=density? 0:1


I think that would clean it up a little.
In response to Kaiochao2536
Kaiochao2536 wrote:
density=density? 0:1


That's an interesting way of doing it. You can also use
density = !density
:)
Have we even considered that these verbs aren't even given to the player?
In response to RedlineM203
This is one of those occasions where it would help a lot if he'd specify what the problem actually was in the first place, instead of saying, "It doesn't work!"
In response to GhostAnime
In a vast reply to all of your overnight comments:

1. Yes it should work, no it does not, and yes the wall density is normal.

2. If you have an attitude, get off my thread.

3. Thanks for the boolean idea, I'll try that.

4. I've done usr, src, and blank.

5. YES BRILLIANT GENIUS, I GIVE THE VERBS.

Edit: 6. I use the verb (my mouse works by the way) and I still bump everything.

Anything else?
In response to Foster AJ
Update: The density = !density also does not work.

It's not my BYOND or DM, as this same function works on other games.
In response to Foster AJ
Alright, this may sound like a stupid question but are you trying to change your own density or someone elses?
If you are trying to change your own density, I don't see a problem. I took your verb coding and put it in my game and it worked fine...
In response to Spire8989
Then this suggests that the verb isn't the problem..

Show us some of your turf code... Do you have any "Enter" or "Bump" procs in your code? Do a search just incase for "Enter(" or "Entered(" etc..
mob
GameMaster
verb
SetDensity()
set category = "Abilities"
src.density = !src.density
src << "Your density is: [src.density]"


This code is fine. There are no problems with it. The problems lie elsewhere. As Farkas said, lets see some turf/Enter() code or anything else that might be causing problems.
In response to Farkas
This problem has been solved.



atom
proc/Bumped()
..()

turf
castle
doorleft
name = "Door"
density = 1
icon = 'doorleft.dmi'
icon_state = "closed"
Bumped()
icon_state = "open"
density = 0
sleep(30)
icon_state = "closed"
density = 1


Here's some of my turf code.

On Bump() the turf's default Bumped() proc is called. The only thing that uses this is the doors, example above. All other turfs use the normal "density = 1" variable, with no Enter(), Entered(), or Bumped().

I removed all Bump() and Bumped() procs from the code and tested - and the verb still does not work.