ID:143302
 
Code:
mob/proc/key2()

var/choice = input(usr,"2 times 3?","Question") in list("2","4","6","I don't know.")

if(choice == "6")
usr << "Correct."
usr:MakeGold()
usr:GiveExp()
var/answer = 1 /* unused var, trying to set something up for a verb to check for in an /if/else setup basically asking the verb to identify a correct responce to allow the verb action to take place. */
else if(choice == "I don't know.")
usr << "Study study study."
else
usr << "Incorrect."



mob/verb/pop_quiz()
Question()


mob/proc/Question()
var/number = rand(1,10)
if(number == 1)
usr:key1()
if(number == 2)
usr:key2()
if(number == 3)
usr:Question()
if(number == 4)
usr:Question()
if(number == 5)
usr:Question()
if(number == 6)
usr:Question()
if(number == 7)
usr:Question()
if(number == 8)
usr:Question()
if(number == 9)
usr:Question()
verb
attack(mob/M as mob in oview(1))
set category = "Combat" //attack a mob within 1 tile of you
pop_quiz()
if(answer == 1)
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M:HP -= damage //take away the damage from M
M:DeathCheck() //check for death with a proc
else usr << "Nothing happens."


Problem description:

I'd do it like this:

verb/attack(var/mob/m in oview(1))
var/mob/player/p = usr
//the line above is there to define the urs's type and making sure the proc link will work
//you should replace this with whatever type your normal client mob is or a parent all posible types share
//in this example the default type is /mob/player
if(p.quiz())
//your attack code

mob/player/proc/quiz()
var/f = rand(1,10)
var/s = rand(1,10)
var/num == input(src,"What is [f] + [s]","Question") as null|num
if(num == f+s) return 1
else return null


In response to Fint
Hey thanx for the responce and the code help, I got another sys working atm through a diff programing route, but maybe I'll use both for different parts of the game.

Mike