PSP Hacks - Forums

Go Back   PSP Hacks - Forums > Tech Talk > LUA Scripting

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-06-2009, 12:24 PM
Gblo6689 Gblo6689 is offline
PSP Newbie
 

Join Date: Nov 2008
Location: Tampa, Florida, USA
Posts: 21
Gblo6689 Has a Beginner Reputation
Default Help with a simple game's code (LUA)

okay so I've been trying to figure out how to do this for a little while now and I figure you might be able to help

I'm trying to make a simple dice game that I and my fiance enjoy playing for the PSP. My problem is that I need the code to recognize if multiple dice have the same value, and if so the player is awarded extra points.

The awarding of points is easy, however I cannot for the life of me think of an efficient way to tell the program to check if 3 of the 5 dice have the same value...

for instance:
if the player rolls 3 sixes he/she gains 600 points
if the player rolls 3 ones he/she gains 1000 points

I'm assigning values as such:

Dice={}
Dice[1]={RollValue=0}
Dice[2]={RollValue=0}
Dice[3]={RollValue=0}
Dice[4]={RollValue=0}
Dice[5]={RollValue=0}

for a=1,5 do
Dice[a].RollValue=math.random(1,6)
end

This is only an exert of the whole code, however, you get the gist.
I currently have the code recognizing the values of single dice and assigning points according to that.

Any help would be appreciated.
Reply With Quote
 

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:16 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©