ID:172356
 
I need to know how to make it so like when you click a guy once he says something, then if you click him again he says something else. I know it is smoething like else, but it gives me errors.



Also say like I need this


                    switch(input("Do you wish to buy this apple'?" , "Seller Guy", text) in list ("Yes","No"))
if("Yes")
if(usr.MaxGold < 10000)
usr << "You need more gold."
if(usr.MaxGold >= 25000)
usr.contents += new /obj/Apple
alert("You buy the apple.")




Under where if says if usr.MaxGold, how do I make it say they have to have another varible to? For example like they also need 200 MaxGold2?
Majinveku wrote:
I need to know how to make it so like when you click a guy once he says something, then if you click him again he says something else. I know it is smoething like else, but it gives me errors.

What you need to do is when you click him the first time, store information in a variable somewhere. Then in the Click() proc, check that variable. If it's what you set it to, then say the other thing, otherwise, say the first thing.
Also say like I need this


>                   switch(input("Do you wish to buy this apple'?" , "Seller Guy", text) in list ("Yes","No"))
> if("Yes")
> if(usr.MaxGold < 10000)
> usr << "You need more gold."
> if(usr.MaxGold >= 25000)
> usr.contents += new /obj/Apple
> alert("You buy the apple.")
>
>
>
>
> Under where if says if usr.MaxGold, how do I make it say they have to have another varible to? For example like they also need 200 MaxGold2?

You can use && (logical AND) between the two statements that you're checking. Take a look at it in the reference.
This is a way to make a person say different things every time you click on him.I left notes so you understand how it works.
mob
var
Check = 1 // The var im using to check if the user has talked to the NPC yet.
mob
NPC
Guy
icon = 'Guy.dmi'
Click()//If he is Clicked on
if(usr.Check==1)//if the users check var is 1 do the following
usr << "First Message"
usr.Check = 2 // set the usr Check var to two
else if(usr.Check==2)//if the users check var is 2 do the following
usr << "Message Two"
usr.Check = 3//sets the usr Check var to 3
else if(usr.Check==3)//if the users Check var is 3 do the following
usr << "Message Three"
//and so on


In response to Jon88
Thanks! You both gave great explantaions and told me exactly what I needed!
In response to Jon88
Okay another problem...


mob
NPCs
Tien
name = "Tien"
icon = 'Tien.dmi'
race = "Human"
npc = 1
powerlevel = 5
maxpowerlevel = 5
Click()
if(usr.race == "Human")
switch(input("Do you wish to learn the Tayioken technique?" , "Tien", text) in list ("Yes","No"))
if("Yes")
if(usr.maxpowerlevel < 22000 && usr.MaxKi < 5000)
usr << "You need more power."
if(usr.maxpowerlevel >= 12000)
usr.contents += new /obj/Tayioken
alert("Tien teachs you the Tayioken technique.")
switch(input("Do you wish to learn the Dondonpa technique?" , "Tien", text) in list ("Yes","No"))
if("Yes")
if(usr.MaxKi < 10000)
usr << "You need to develop more ki."
if(usr.maxpowerlevel >= 34000 && usr.MaxKi >5000)
usr.contents += new /obj/DonDonPa
alert("Tien teachs you the DonDonPa technique.")
else
if(usr.Check==1)
usr << "First Message"
usr.Check = 2

else if(usr.Check==2)
usr << "Message Two"
usr.Check = 3

else if(usr.Check==2)
usr << "...."
usr.Check = 3<dm>


Problem is, when you click him.. nothing happens?
In response to Majinveku
You never put a if("No") Twice And make sure your race is Human
mob
NPCs
Tien
name = "Tien"
icon = 'Tien.dmi'
race = "Human"
npc = 1
powerlevel = 5
maxpowerlevel = 5
Click()
if(usr.race == "human")
switch(input("Do you wish to learn the Tayioken technique?" , "Tien", text) in list ("Yes","No"))
if("Yes")
if(usr.maxpowerlevel < 22000 && usr.MaxKi < 5000)
usr << "You need more power."
if(usr.maxpowerlevel >= 12000)
usr.contents += new /obj/Tayioken
alert("Tien teachs you the Tayioken technique.")
if("No")
alert("Okay, just come back to me if you want to learn it.")
switch(input("Do you wish to learn the Dondonpa technique?" , "Tien", text) in list ("Yes","No"))
if("Yes")
if(usr.MaxKi < 10000)
usr << "You need to develop more ki."
if(usr.maxpowerlevel >= 34000 && usr.MaxKi >5000)
usr.contents += new /obj/DonDonPa
alert("Tien teachs you the DonDonPa technique.")
if("No")
alert("Okay, just come back to me if you want to learn it.")
else
if(usr.Check==1)
usr << "First Message"
usr.Check = 2

else if(usr.Check==2)
usr << "Message Two"
usr.Check = 3

else if(usr.Check==2)
usr << "...."
usr.Check = 3



the last part of my problem is he does nothing but the thing is I want it to be like this, if you are human, he asks you if you want to learn the techs, and if you are ANy other race then he just talks to you with the Message 1, message 2, message 3 thing. Anyone know how I can do this?
In response to Majinveku
I'm guessing you misplaced the first else. Try this

mob
NPCs
Tien
name = "Tien"
icon = 'Tien.dmi'
race = "Human"
npc = 1
powerlevel = 5
maxpowerlevel = 5
Click()
if(usr.race == "human")
switch(input("Do you wish to learn the Tayioken technique?" , "Tien", text) in list ("Yes","No"))
if("Yes")
if(usr.maxpowerlevel < 22000 && usr.MaxKi < 5000)
usr << "You need more power."
if(usr.maxpowerlevel >= 12000)
usr.contents += new /obj/Tayioken
alert("Tien teachs you the Tayioken technique.")
if("No")
alert("Okay, just come back to me if you want to learn it.")
switch(input("Do you wish to learn the Dondonpa technique?" , "Tien", text) in list ("Yes","No"))
if("Yes")
if(usr.MaxKi < 10000)
usr << "You need to develop more ki."
if(usr.maxpowerlevel >= 34000 && usr.MaxKi >5000)
usr.contents += new /obj/DonDonPa
alert("Tien teachs you the DonDonPa technique.")
if("No")
alert("Okay, just come back to me if you want to learn it.")
else
if(usr.Check==1)
usr << "First Message"
usr.Check = 2
else if(usr.Check==2)
usr << "Message Two"
usr.Check = 3

else if(usr.Check==2)
usr << "...."
usr.Check = 3