ID:146573
 
Code:
mob/players
Login() // logging on in...
var/mob/players/A = usr
if(A.everwood==1)
A.loc = locate(/turf/everwoodsh)
if(A.kishkan==1)
A.loc = locate(/turf/start)
if(A.terrash==1)
A.loc = locate(/turf/terrashsh)
if(A.zenith==1)
A.loc = locate(/turf/zenithsh)
if(A.zenith==0&&A.everwood==0&&A.kishkan==0&&A.terrash==0)
A.loc = locate(/turf/start)
var // player variables
terrash = 0
kishkan = 0
zenith = 0
everwood = 0

obj
terrash
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bump()
var/mob/players/M = usr
if(M.kishkan==1)
M.kishkan = 0
if(M.zenith==1)
M.zenith = 0
if(M.everwood==1)
M.everwood = 0
if(M.terrash==0)
M.terrash = 1
M << "<b>Start Modification Saved."
kishkan
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bump()
var/mob/players/M = usr
if(M.terrash==1)
M.terrash = 0
if(M.zenith==1)
M.zenith = 0
if(M.everwood==1)
M.everwood = 0
if(M.kishkan==0)
M.kishkan = 1
M << "<b>Start Modification Saved."
zenith
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bump()
var/mob/players/M = usr
if(M.kishkan==1)
M.kishkan = 0
if(M.terrash==1)
M.terrash = 0
if(M.everwood==1)
M.everwood = 0
if(M.zenith==0)
M.zenith = 1
M << "<b>Start Modification Saved."
everwood
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bump()
var/mob/players/M = usr
if(M.kishkan==1)
M.kishkan = 0
if(M.zenith==1)
M.zenith = 0
if(M.terrash==1)
M.terrash = 0
if(M.everwood==0)
M.everwood = 1
M << "<b>Start Modification Saved."

turf
everwoodsh
icon = 'lightgrass.dmi'
zenithsh
icon = 'snow.dmi'
icon_state = "ice5"
terrashsh
icon = 'lightgrass.dmi'


Problem description:

When I bump any of the objs listed, it doesn't do anything. What's the problem here?


If I may channel LummoxJr's spirit: "No put usr in proc. Ungh."

That effectively describes what's going on. Usr is unfriendly. Unless the thing you're putting it in is a verb, you will get problems.

In this case, there's an easy fix. Bump() gives you an argument, equal to the thing that did the bumping. So you can do this:

turf/Thingy/Bump(atom/a) // Tell the Bump() procedure to put whoever did the bumping in the variable a
if(ismob(a)) if(a:client)
var/mob/player/m=a
//Your stuff



a isn't neccessarily a mob, nor a player. The ifs check that a is a mob, and the client check is to make sure it's a player. Note that the colon (:) thingy there is naughty and you shouldn't use it. So rewrite this without it, it's just a quick example, and you already know a is a mob so it's fairly safe.

I so bet I'm going to get shouted down over use of colon.
An object's own Bump function is called when it bumps something else, not when it gets bumped. What you might want to do is to create a new function called Bumped and call it in Bump.

Next, and not exactly related to your problem, but still helpful...

You don't need a lot of variables. Try using just a single variable for the relocation and set it to a type path. Then relocate to it.
atom/Bumped()
atom/movable/Bump(atom/A)
A.Bumped(src)

mob/players
Login() // logging on in...
loc=locate(relocation)
var // player variables
terrash = 0
kishkan = 0
zenith = 0
everwood = 0
relocation = /turf/start

obj
terrash
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bumped(mob/players/M)
if(istype(M,/mob/player))
M.relocation = /turf/everwoodsh
M << "<b>Start Modification Saved.</b>"
kishkan
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bumped(mob/players/M)
if(istype(M,/mob/player))
M.relocation = /turf/everwoodsh
M << "<b>Start Modification Saved.</b>"
zenith
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bumped(mob/players/M)
if(istype(M,/mob/player))
M.relocation = /turf/everwoodsh
M << "<b>Start Modification Saved.</b>"
everwood
icon = 'building.dmi'
icon_state = "bigshroom"
density = 1
Bumped(mob/players/M)
if(istype(M,/mob/player))
M.relocation = /turf/everwoodsh
M << "<b>Start Modification Saved.</b>"

turf
everwoodsh
icon = 'lightgrass.dmi'
zenithsh
icon = 'snow.dmi'
icon_state = "ice5"
terrashsh
icon = 'lightgrass.dmi'
In response to Loduwijk
I may be doing something wrong here, but..


Basics.dm:2447:error:Bumped :undefined proc
Basics.dm:2461:error:Bumped :undefined proc
Basics.dm:2475:error:Bumped :undefined proc
Basics.dm:2489:error:Bumped :undefined proc
Basics.dm:64:error:Bumped :undefined proc
Basics.dm:66:error:A.Bumped:undefined proc
In response to Jp
Jp wrote:
I so bet I'm going to get shouted down over use of colon.

Well, it's a bogus use of a colon for sure, but probably much worse is that you thought Bump() was a turf proc, and are doing Bump() backwards.

In Bump(), src is the thing that did the bumping, and the argument is the thing that got bumped.

Lummox JR
In response to Jp
Jp wrote:
If I may channel LummoxJr's spirit: "No put usr in proc. Ungh."

That effectively describes what's going on. Usr is unfriendly. Unless the thing you're putting it in is a verb, you will get problems.

On the other hand, usr is, in fact, valid in certain procs! Some good examples would be client/Topic(), atom/Click(), atom/DblClick(), and mob/Stat()! I think that it's very important to know exactly what usr is, which is why, Sin, that you should read the usr lecture!
In response to Jp
Maybe it's due to the fact that I'm a new coder and I have a hard time comprehending this stuff, but JP's doesn't work either. No compilation errors, it just doesn't work.
In response to Lummox JR
Oh... Um... oops?
In response to Sinoflife
I didn't type that up right, but it should have been easy for you to spot.

Just change atom/Bumped() to atom/proc/Bumped()