Jump to content




Random Choice add 1 to a variable


  • You cannot reply to this topic
2 replies to this topic

#1 Zeoic

  • Members
  • 12 posts

Posted 28 April 2012 - 11:50 PM

How would i go about making a program that would pick one word from a table and then add one to that variable.
Pretty much make a thing that when you type Mine it will print "You mined some (Random item here)!" And then it puts what yo must mined into your inventory (Variables).

Thanks
- Zeoic

#2 Zeoic

  • Members
  • 12 posts

Posted 29 April 2012 - 02:46 AM

Can someone please help me?

#3 libraryaddict

  • New Members
  • 195 posts

Posted 29 April 2012 - 03:44 AM

If read() == "mine" then
mine = mine+1
end

Or you could use tables..
Table[MINE] = 0
Table[STONE] = 0
print("You can either use mine STONE or make MINE")
Pig = string.upper(read())
if Table[Pig] then
Table[Pig] = Table[Pig]+1
print("You "..Pig.."'ed and now you have another "..Table[Pig].."!")
end

The string.upper converts it to upper capitals.
Making sure they enter "MINE" even if they do "MinE"





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users