Jump to content

Recommended Posts

Hello, folks! I'm so glad to be here, and expect to stick around for a while, as being the go-to tech guy on a vbulletin forum (didn't ask for it, happened by default) has forced me to learn PHP far beyond the basic experience I had with it in my first year of college. Before I ask a question that makes me look absolutely stupid, what do you folks need to know in order to help me out? Perhaps I can try to vaguely explain the situation, and we can go from there.

 

There's a poker game I have in my forum. Following, is a link to the download page on vbulletin.org. It should have some info.

 

http://www.vbulletin.org/forum/showthread.php?t=159151

 

Of the demo pictures posted, the one on the left shows the buttons that you can click to choose what you want your next move to be. How could I add one of those buttons so that the players would have an option to define the value of their bet rather than a predetermined one? I already know the math for it all, pretty basic. I just want to know how to apply the function to a button. Do I make sense?  :shrug:

 

Thanks again, and the forum looks great!

well if you want it to be dynamic, you want to go with javascript for a function that changes what the bet to be played is. For PHP, you will have to have said button submit to a form, and then use that form to update the value of the bet.

I don't mind updating to a form, but that's something I just don't know how to do. I'm trying to avoid biting off more than I could chew at the moment, although I'm sure once I feel more comfortable with PHP I'll go back and start messing with Java. How would I go about creating a new form and anything else required?

Thanks for that info. It does help, and has given me a lot of info to arm myself with this situation until I figure it out.

 

Alright, so basically, and this is me thinking outloud amongst PHP coders who can correct me if I'm making things harder...

 

I could create a new variable for the persons defined bet, say $userbet. So there's one button for the person to raise. Another to check, another to fold, and hopefully soon, one to pick your bet.

 

If $pokerplayer selects $raise, then the appropriate amount would show, depending on what round it is. In other words, $pot += $raise;. All of that is already set up. However, if $pokerplayer selects $userbet, a form would show, and to make a long story short, $pot += $userbet;?

 

Soooo... something along the lines of (this is a small blind round)...

if($pcash > $smallblind)

{

$raise = $smallblind;

$pcash = $pcash - $smallblind;

}

else

{

$raise = $pcash;

$pcash = 0;

}

$pot += $raise;

                {

                else

                        $raise = $userbet;

                        $pcash = $pcash - $userbet;

                }

                $pot += $raise;

 

The part in italics is what I added myself right now. Remember, I'm not a pro. Just a novice who's brain is really trying to absorb all this useful info.

well firstly, that is syntactically incorrect. you have an else statement that isn't connected to an if statement. (also, you can enclose your code in code tags to make it easier to read in the future.)

 

this part is wrong:

//you need an if statement above the else statement
{//this is wrong
                else //you need a opening bracket here
                   ##{
                        $raise = $userbet;
                        $pcash = $pcash - $userbet;
                }
                $pot += $raise;

 

I am not sure what if statement you would need connected to that part, becaue I don't really know how poker works, and small blind rounds make no sense to me.

 

Hope that helps! I'll be leaving work soon, so I wont be online for the rest of the night. Good luck, and if you can't get any more help you can email me

Hm. I did know that, so I don't know what I was trying to do there, but... I did give you some irrelevant information that may have confused my intent. The $raise variable is how much money the person is actually betting that round, and the $pot is how much money is currently up for grabs. I want to do it so that if a person clicks on the "Raise" button, then the pot updates to pot + raise OR if the person clicks on the "User bet" button, a form pops up allowing them to choose how much money to bet. Then, that entered amount goes into the pot, resulting in pot = pot + user bet instead of [/b]pot = pot + raise[/b].

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.