ID:159317
 
my first problem is that I'm not sure how to make a pop-up window like this

http://img514.imageshack.us/img514/7971/sadi.jpg

that allows users to choose options and have actions done based on their choice. Which transitions into my next question: I want to have players be able to choose their powers when they join the world, and their choice of power decides what verbs they receive. Right now when you log onto the world you just get all verbs that have been created. How do I fix this problem?

mob
icon = 'male.dmi' //make it so all mobs will be created with the person icon

var

water = 0
fire = 0
electricity = 0
attack = 1
eattack = 0
defense = 1
exp = 0
max_exp = 100
HP = 30 //declares a new variable called HP with a value of 30
Wealth = 0
maxhp = 100
spark = 0
flame = 0


mugger
HP = 20
defense = 1
exp = 40
icon = 'mugger.dmi'

bug //new prototype
HP = 5
defense = 0
exp = 20
icon = 'bug.dmi' //overrides the parent's icon, the parent icon is person.dmi
Click()
usr<< "please dont kill me!"

Del()
var/obj/gold/G = new(loc) //create a new obj from the gold blueprint
G.amount = rand (1,100) //sets its amount varibale randomly
..() //call the parent


Login()
icon_state = gender //when a player logs in, make their icon's state
world<< "[src] has logged in!" //announces player entry
..() //the gender of their key. Then call the parent!

Stat()
stat("Wealth",Wealth)
stat("HP","[HP]/[maxhp]")
stat("attack",attack + eattack)
stat("defense",defense)
stat("exp","[exp]/[max_exp]")


proc
DeathCheck() //check to see if attack is deadly
if(src.HP <=0) //if the defender's HP is low enough and is not a player
usr.exp += src.exp // gives the exp of defeated mob to attacker
if(src.client) // if the dead person is a player
src.HP = src.maxhp
src.Move(locate(1,20,1))
world<< "[src] was killed by [usr]!" //give the death messaging
else
del (src) //delete whatever just died







LevelUp()
if(exp >= max_exp) //if the exp is greater than or equal to max exp
attack++ //add 1 to the attack
defense++ //add 1 to the defense
exp -= max_exp //make sure they dont lose exp
max_exp *=2 //multiply the max_exp by 2
HP *=1.5 //multiply the HP by 1.5
src << "You leveled up!" //tell the src they leveled up.
//dont use usr in proc


verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
var/damage = src.attack + src.eattack -M.defense //attack - enemy defense
usr<< "You attack [M] for [damage] damage!" //send this message to the user
M.HP -= damage //take away damage from M
M.DeathCheck() //check for death with a proc
src.LevelUp()

phase()
density = !density
if(density)
usr<< "your atom density normalizes."
else
usr<< "you focus on the ethereal plane."
set_name(N as text)
set desc = "(\"new name\") Change your name."
name = N

world_say(msg as text) //what the usr says is passed into "msg" as text world<< "[usr]: [msg]" //the world sees chatroom-like output
say(msg as text)
view() << "[usr] says: [msg]"

whisper(M as mob in world,txt as text)
usr<< "you tell [M]: [txt]"
M<< "[usr] tells you: [txt]"

vanish()
if(invisibility <= 0)
invisibility = 1
usr<< "You bend the light to conceal your location."
else
invisibility = 0
usr<< "You correct the light around you."

rest()
usr<< "you begin to rest"
while(usr.HP < usr.maxhp)
usr.HP += 10
sleep(20)
if(usr.HP == usr.maxhp)
usr<< "you finish resting!"

Spark()
if(spark <=0)
usr.eattack = usr.attack
spark = 1
overlays += 'spark.dmi'
usr<< "a surge of energy flows through your body"
else
spark = 0
usr.eattack = 0
usr<< "the power subsides"


as you can see I added the vars fire, water, and electricity. I'm assuming I have to do something like if fire = 1 then you get such and such fire verbs, etc.
mob/var
water = 0
fire = 0
electricity = 0

mob/verb/Choose_Powers()
switch(alert("Which of these special elements do you wish to have at your disposal?","Choose Powers","Water","Fire","Electricity"))
if("Water")
water = 1
verbs += /mob/proc/Water_Attack
if("Fire")
fire = 1
verbs += /mob/proc/Fire_Attack
if("Electricity")
electricity = 1
verbs += /mob/proc/Electric_Attack

//Procs cannot be accessed directly from players, however, they can be accessed if they are given to the player
//as verbs, barring some condition that has to be met. As illustrated above, this is a good way to give them the
//proc as a verb so they can use it, just like how you want, as opposed to giving them all the verbs when they log in.

mob/proc
Water_Attack()
if(water) //if they actually obtained the verb legitimately, but this var is not necessary if they can't get it any other way.
//insert code here
Fire_Attack()
if(fire) //same as above
//insert code here
Electric_Attack()
if(electricity) //same as above
//insert code here
In response to ArcaneDragonX
where you say "insert code here" is that where I place the verbs that are exclusive for that moveset?
In response to Enomus
That's not where you place to verbs, that's where you put the actual code to be executed by that verb/proc.

This was just an example for one verb, if you have more verbs that need to be added, put them in the switch case where the other verb is being added.
In response to ArcaneDragonX
I did this and a bunch of inconsistent indentation errors came up on the choose powers verb
 

mob
icon = 'male.dmi' //make it so all mobs will be created with the person icon

var
electricity = 0
fire = 0
water = 0
attack = 1
eattack = 0
edefense = 0
defense = 1
exp = 0
max_exp = 100
HP = 30 //declares a new variable called HP with a value of 30
Wealth = 0
maxhp = 100
spark = 0
flame = 0
mist = 0


mugger
HP = 20
defense = 1
exp = 40
icon = 'mugger.dmi'

bug //new prototype
HP = 5
defense = 0
exp = 20
icon = 'bug.dmi' //overrides the parent's icon, the parent icon is person.dmi
Click()
usr<< "please dont kill me!"

Del()
var/obj/gold/G = new(loc) //create a new obj from the gold blueprint
G.amount = rand (1,100) //sets its amount varibale randomly
..() //call the parent


Login()
icon_state = gender //when a player logs in, make their icon's state
world<< "[src] has logged in!" //announces player entry
..() //the gender of their key. Then call the parent!

Stat()
stat("Wealth",Wealth)
stat("HP","[HP]/[maxhp]")
stat("attack",attack + eattack)
stat("defense",defense + edefense)
stat("exp","[exp]/[max_exp]")


proc
DeathCheck() //check to see if attack is deadly
if(src.HP <=0) //if the defender's HP is low enough and is not a player
usr.exp += src.exp // gives the exp of defeated mob to attacker
if(src.client) // if the dead person is a player
src.HP = src.maxhp
src.Move(locate(1,20,1))
world<< "[src] was killed by [usr]!" //give the death messaging
else
del (src) //delete whatever just died







LevelUp()
if(exp >= max_exp) //if the exp is greater than or equal to max exp
attack++ //add 1 to the attack
defense++ //add 1 to the defense
exp -= max_exp //make sure they dont lose exp
max_exp *=2 //multiply the max_exp by 2
HP *=1.5 //multiply the HP by 1.5
src << "You leveled up!" //tell the src they leveled up.
//dont use usr in proc


mob/verb
Choose_Powers()
switch(alert("Which of these special elements do you wish to have at your disposal?","Choose Powers","Water","Fire","Electricity"))
if("Water")
water = 1
verbs += mist
if("Fire")
fire = 1
verbs += flame
if("Electricity")
electricity = 1
verbs += spark



attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
var/damage = src.attack + src.eattack -M.defense + M.edefense //attack - enemy defense
usr<< "You attack [M] for [damage] damage!" //send this message to the user
M.HP -= damage //take away damage from M
M.DeathCheck() //check for death with a proc
src.LevelUp()

phase()
density = !density
if(density)
usr<< "your atom density normalizes."
else
usr<< "you focus on the ethereal plane."
set_name(N as text)
set desc = "(\"new name\") Change your name."
name = N

world_say(msg as text) //what the usr says is passed into "msg" as text world<< "[usr]: [msg]" //the world sees chatroom-like output
say(msg as text)
view() << "[usr] says: [msg]"

whisper(M as mob in world,txt as text)
usr<< "you tell [M]: [txt]"
M<< "[usr] tells you: [txt]"

vanish()
if(invisibility <= 0)
invisibility = 1
usr<< "You bend the light to conceal your location."
else
invisibility = 0
usr<< "You correct the light around you."

rest()
usr<< "you begin to rest"
while(usr.HP < usr.maxhp)
usr.HP += 10
sleep(20)
if(usr.HP == usr.maxhp)
usr<< "you finish resting!"

spark()
if(spark <=0)
usr.eattack = usr.attack
spark = 1
overlays += 'spark.dmi'
usr<< "a surge of energy flows through your body"
else
spark = 0
usr.eattack = 0
usr<< "the power subsides"

mist()
if(mist <=0)
usr.edefense = usr.defense
mist = 1
usr<< "mist envelops your body"
else
mist = 0
usr.eattack = 0
usr<< "the mist fades away"

flame()
if(flame <=0)
usr.edefense += 0.5
usr.eattack += 0.5
flame = 1
usr<< "fire erupts from your palms"
else
flame = 0
usr.edefense = 0
usr.eattack = 0
usr<< "the flames subside"


In response to Enomus
I copy and pasted the code, it works fine; no indentation errors. Simple fix, really, its not that complicated. You used four spaces when moving from one line to the next, I used a tab. Just delete the tabs and replace them with four spaces, however I highly suggest you use tabs; it makes moving from one line or spot to the next really, really easy.

I see no problem with the code, plus I fixed a couple things.

mob
icon = 'male.dmi' //make it so all mobs will be created with the person icon

var
electricity = 0
fire = 0
water = 0
attack = 1
eattack = 0
edefense = 0
defense = 1
exp = 0
max_exp = 100
HP = 30 //declares a new variable called HP with a value of 30
Wealth = 0
maxhp = 100
spark = 0
flame = 0
mist = 0


mugger
HP = 20
defense = 1
exp = 40
icon = 'mugger.dmi'

bug //new prototype
HP = 5
defense = 0
exp = 20
icon = 'bug.dmi' //overrides the parent's icon, the parent icon is person.dmi
Click()
usr<< "please dont kill me!"

Del()
var/obj/gold/G = new(loc) //create a new obj from the gold blueprint
G.amount = rand (1,100) //sets its amount varibale randomly
..() //call the parent


Login()
icon_state = gender //when a player logs in, make their icon's state
world<< "[src] has logged in!" //announces player entry
..() //the gender of their key. Then call the parent!

Stat()
stat("Wealth",Wealth)
stat("HP","[HP]/[maxhp]")
stat("attack",attack + eattack)
stat("defense",defense + edefense)
stat("exp","[exp]/[max_exp]")


proc
DeathCheck() //check to see if attack is deadly
if(src.HP <=0) //if the defender's HP is low enough and is not a player
usr.exp += src.exp // gives the exp of defeated mob to attacker
if(src.client) // if the dead person is a player
src.HP = src.maxhp
src.Move(locate(1,20,1))
world<< "[src] was killed by [usr]!" //give the death messaging
else
del (src) //delete whatever just died







LevelUp()
if(exp >= max_exp) //if the exp is greater than or equal to max exp
attack++ //add 1 to the attack
defense++ //add 1 to the defense
exp -= max_exp //make sure they dont lose exp
max_exp *=2 //multiply the max_exp by 2
HP *=1.5 //multiply the HP by 1.5
src << "You leveled up!" //tell the src they leveled up.
//dont use usr in proc


mob/verb
Choose_Powers()
switch(alert("Which of these special elements do you wish to have at your disposal?","Choose Powers","Water","Fire","Electricity"))
if("Water")
water = 1
verbs += /mob/proc/mist //fixed
if("Fire")
fire = 1
verbs += /mob/proc/flame //fixed
if("Electricity")
electricity = 1
verbs += /mob/proc/spark //fixed



attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
var/damage = src.attack + src.eattack -M.defense + M.edefense //attack - enemy defense
usr<< "You attack [M] for [damage] damage!" //send this message to the user
M.HP -= damage //take away damage from M
M.DeathCheck() //check for death with a proc
src.LevelUp()

phase()
density = !density
if(density)
usr<< "your atom density normalizes."
else
usr<< "you focus on the ethereal plane."
set_name(N as text)
set desc = "(\"new name\") Change your name."
name = N

world_say(msg as text) //what the usr says is passed into "msg" as text world<< "[usr]: [msg]" //the world sees chatroom-like output
world << "[usr] says: [msg]"
say(msg as text)
view() << "[usr] says: [msg]"

whisper(M as mob in world,txt as text)
usr<< "you tell [M]: [txt]"
M<< "[usr] tells you: [txt]"

vanish()
if(invisibility <= 0)
invisibility = 1
usr<< "You bend the light to conceal your location."
else
invisibility = 0
usr<< "You correct the light around you."

rest()
usr<< "you begin to rest"
while(usr.HP < usr.maxhp)
usr.HP += 10
sleep(20)
if(usr.HP == usr.maxhp)
usr<< "you finish resting!"

mob/proc
spark()
if(spark <=0)
usr.eattack = usr.attack
spark = 1
overlays += 'spark.dmi'
usr<< "a surge of energy flows through your body"
else
spark = 0
usr.eattack = 0
usr<< "the power subsides"

mist()
if(mist <=0)
usr.edefense = usr.defense
mist = 1
usr<< "mist envelops your body"
else
mist = 0
usr.eattack = 0
usr<< "the mist fades away"

flame()
if(flame <=0)
usr.edefense += 0.5
usr.eattack += 0.5
flame = 1
usr<< "fire erupts from your palms"
else
flame = 0
usr.edefense = 0
usr.eattack = 0
usr<< "the flames subside"
In response to ArcaneDragonX
Ah after copying and pasting your code it worked. Thanks you for the help. Is there any way I can get rid of the choose power verb after I make the selection
In response to Enomus
mob/verb
Choose_Powers()
switch(alert("Which of these special elements do you wish to have at your disposal?","Choose Powers","Water","Fire","Electricity"))
if("Water")
water = 1
verbs += /mob/proc/mist //fixed
if("Fire")
fire = 1
verbs += /mob/proc/flame //fixed
if("Electricity")
electricity = 1
verbs += /mob/proc/spark //fixed
verbs -= /mob/verb/Choose_Powers // <--- Right here.
In response to ArcaneDragonX
thanks for your time and patience :)
In response to Enomus
No problem! If you need anymore help, don't hesitate to ask.