ID:927122
 
(See the best response by Toddab503.)
Not sure if this is even coded right, still on the book, but it says my if statement has no effect and i cant figure out what to do

Code:
turf
StartingLocations
firestart
icon = 'firestart.dmi'
Click()
if(usr.Firebegin())
..()

mob
verb
Firebegin()
icon = 'firebasetan.dmi'
usr.loc = locate(85,78,2)


Problem description:
Im trying to make it so that when the player logs in they get to a screen where they would click the button and it would give them a new icon and start them at the predetermined location.
usr.icon = 'firebasetan.dmi'
It still says "If statement has no effect." I coded it a different way and i got no errors but when i clicked on the turf it didnt work. Heres the different way.
turf
startinglocations
waterstart
icon = 'waterstart.dmi'
Click()
usr.icon = 'waterbasetan.dmi'
usr.loc = locate(88,88,2)
..()
That's because the verb doesn't actually return a value. There's no point to having that if statement anyway, since you have no behavior contingent upon the verb succeeding, or no means to make it fail.
So how should i have coded it?
turf
startinglocations
waterstart
icon = 'waterstart.dmi'
Click()
usr.icon = 'waterbasetan.dmi'
usr.loc = locate(88,88,2)
..() //this line is unnecessary if there's no superclass behavior.


This should work just fine. If it isn't working, you've done something else wrong. Make sure you've placed this turf, and your click isn't being obstructed. Put a debug message in there to make sure that the click isn't being interrupted.
Nope still not working the main problem is when i click it doesnt do anything idky
i have this maybe its the problem?
mob
Login()
world << "Welcome!"
src.loc = locate(/turf/Other/Blank)
icon = 'blank.dmi'
..()

this was supose to bring them to the choose class screen where as i put a blank icon in the middle to give them a palce to go.
src.icon = 'blank.dmi'
In response to Foxhounds
This is entirely unhelpful. Given the scenario as to how he's using icon = 'blank.dmi' in Login(), src is already implied.
Lol could there be a problem elsewhere, I mean theres not munch of a code. Its just that login and the other coding that brings them to the choose screen turf on the map. But for some reason clicking the turf does nothing. I also have multiple turfs of the same turf that can be clicked so for example i have like 4 waterstar turfs that are over the part of the choose screen so that any where over it a palyer clciks it would work, but i am hoping thats not the problem.
turf
StartingLocations
firestart
icon = 'firestart.dmi'
Click()
Firebegin()
..()
proc
Firebegin()
usr.icon = 'firebasetan.dmi'
usr.loc = locate(85,78,2)
In response to Shwb1
Shwb1 wrote:
> turf
> StartingLocations
> firestart
> icon = 'firestart.dmi'
> Click()
> Firebegin()
> ..()
> proc
> Firebegin()
> usr.icon = 'firebasetan.dmi'
> usr.loc = locate(85,78,2)
>
>


Don't use usr in procs. I'm not even sure what you were trying to accomplish with this snippet.
In response to Albro1
Albro1 wrote:
Shwb1 wrote:
> > turf
> > StartingLocations
> > firestart
> > icon = 'firestart.dmi'
> > Click()
> > Firebegin()
> > ..()
> > proc
> > Firebegin()
> > usr.icon = 'firebasetan.dmi'
> > usr.loc = locate(85,78,2)
> >
> >

Don't use usr in procs. I'm not even sure what you were trying to accomplish with this snippet.

In this case, actually, usr would work just fine, since it's a proc being called from an action that has a defined usr.

It's just bad practice.
Actually when i use that code it still doesnt work and it gives me this error: empty type name (indentation error?). When i fix the indentation making it like this:
turf    
StartingLocations
firestart
icon = 'firestart.dmi'
Click()
Firebegin()
..()

It still doesnt do anything when I click.
Best response
Ter13 wrote:
> turf
> startinglocations
> waterstart
> icon = 'waterstart.dmi'
> Click()
> usr.icon = 'waterbasetan.dmi'
> usr.loc = locate(88,88,2)
> ..() //this line is unnecessary if there's no superclass behavior.
>


That was almost right. If clicking isn't doing anything, chances are you need to set the layer and mouse opacity. Like this...

> turf
> startinglocations
> waterstart
> icon = 'waterstart.dmi'
> layer = 100 //An example. Just make sure its higher than the turf/splash layer.
> mouse_opacity = 2 //Clicks work, no matter what icon; even if the icon has no pixels in it.
> Click()
> usr.icon = 'waterbasetan.dmi'
> usr.loc = locate(88,88,2)
> ..() //this line is unnecessary if there's no superclass behavior.
>
My god thank you it works now. Had to pause the whole coding but now i can continue thanks again. :D
You're very welcome. I'm glad I could be of some help.