ID:170498
 
mob
Human_Master
icon = 'npc.dmi'
icon_state = "humandojo"
npc = 1
DblClick()
if(usr.dojo == 0)
alert("Welcome to the Dojo.")
alert("In order to leave this Dojo you must complete certain tasks to become a warrior with a Novice fighting style.")
alert("First, let me test your ki level and determine your Center of Gravity.")
usr.SetCGrav()
alert("Now that I have determined your Center of Gravity, go and begin to train and become a great warrior. Come back to me when you think you have reached your limit.")
usr.dojo = 1
if(usr.dojo == 1)
if(usr.powerlevel < 10)
alert("You are still not strong enough to leave this island. Come back soon though.")
else
alert("Ahh, my son you have finally reached the limit of my training. Here, enjoy your new fighting style.")
usr.style = "Novice"
alert("Oh yea, you might want to learn a little bit about your fighting style.")
alert("Your fighting style determines how you attack and also increases your damage.")
alert("This style was fairly easy to acquire, but the next styles will not be as easy.")
alert("Good luck my young warrior!")


Nothing is working for me. For some reason, when I double click on the npc, nothing happens at all. Please help.
mob
Human_Master
icon = 'npc.dmi'
icon_state = "humandojo"
npc = 1
DblClick()
if(usr.dojo == 0)
alert(usr,"Welcome to the Dojo.")
alert(usr,"In order to leave this Dojo you must complete certain tasks to become a warrior with a Novice fighting style.")
alert(usr,"First, let me test your ki level and determine your Center of Gravity.")
usr.SetCGrav()
alert(usr,"Now that I have determined your Center of Gravity, go and begin to train and become a great warrior. Come back to me when you think you have reached your limit.")
usr.dojo = 1
if(usr.dojo == 1)
if(usr.powerlevel < 10)
alert(usr,"You are still not strong enough to leave this island. Come back soon though.")
else
alert(usr,"Ahh, my son you have finally reached the limit of my training. Here, enjoy your new fighting style.")
usr.style = "Novice"
alert(usr,"Oh yea, you might want to learn a little bit about your fighting style.")
alert(usr,"Your fighting style determines how you attack and also increases your damage.")
alert(usr,"This style was fairly easy to acquire, but the next styles will not be as easy.")
alert(usr,"Good luck my young warrior!")

In response to Dession
It's still not working. I don't know why..
In response to Dession
You could try changing all the usr's to src's.
In response to Plagu3r
alert()'ll go to the src, maybe that's why.

You need to define the path for it to go to the usr.

Look up alert() in the guide/ref, and it'll show you what to do.
You shouldn't use if(myVar==1) and if(myVar==0) checks. Instead, say if(myVar) and if(!myVar), respectively. The latter is much, much more robust.

You see, although we consider them to be similar, 0, null, and "" are actually considered to be different values by the compiler. Therefore, if myVar is really equal to null, but you check for if(myVar==0), then the compiler will think "myVar is equal to null, not 0.", and it will pass it by.

To solve the problem, we could do this:

if(myVar==0||myVar==null||myVar=="")


However, thanks to the ! operator (read as "NOT"), we can just do this:

if(!myVar)


Also, remember, if you're already checking for if(!myVar), it's much better to check for else instead of if(myVar).

Knowing that, we realize that it should instead be:

mob
Human_Master
icon = 'npc.dmi'
icon_state = "humandojo"
npc = 1
DblClick()
if(!usr.dojo)
alert("Welcome to the Dojo.")
alert("In order to leave this Dojo you must complete certain tasks to become a warrior with a Novice fighting style.")
alert("First, let me test your ki level and determine your Center of Gravity.")
usr.SetCGrav()
alert("Now that I have determined your Center of Gravity, go and begin to train and become a great warrior. Come back to me when you think you have reached your limit.")
usr.dojo = 1
else
if(usr.powerlevel < 10)
alert("You are still not strong enough to leave this island. Come back soon though.")
else
alert("Ahh, my son you have finally reached the limit of my training. Here, enjoy your new fighting style.")
usr.style = "Novice"
alert("Oh yea, you might want to learn a little bit about your fighting style.")
alert("Your fighting style determines how you attack and also increases your damage.")
alert("This style was fairly easy to acquire, but the next styles will not be as easy.")
alert("Good luck my young warrior!")
In response to Elation
Elation wrote:
alert()'ll go to the src, maybe that's why.

You need to define the path for it to go to the usr.

Look up alert() in the guide/ref, and it'll show you what to do.

No it won't. Elation, alert(), by default, outputs to usr.

Also, don't say "the usr", because it conveys that usr==user, which, of course, it isn't.
In response to Dession
Dession, that's completely useless. By default, alert() outputs itself to usr.
In response to MasterLink2003
MasterLink2003 wrote:
You could try changing all the usr's to src's.

That would just make the program attempt to alert() the NPC being DblClick()ed.
In response to Wizkidd0123
Oh my bad.
In response to Wizkidd0123
Sorry Wiz, didn't know that. What a fool I be. :(
In response to Elation
Well, I'll join you guys. Well, I thought it would at the least help some.