Making betting system using data-base money on a dice role guessing game

I’m trying to create a 2-page game where you bet a set amount of cash on a dice you roll vs the computer, the highest number wins. The player also gets a luck stat that gets added to the number they roll.

There is a 3rd page with character info of how much gold and luck you start off with.

If you run out of gold in should lock you out of playing.

I have set the CSS and all the database values but I am very weak when it comes to PHP so it’s hard for me to figure this out.

I have tried to make a normal dice game before adding database side objects but because I do not possess a server at home it’s hard for me to even test if this works, I’ve searched online as well with no luck provided.


  <main>     <form action="roll.php" method="post">       <p>         You currently have <?php echo $  user_row['gold'];?> gold.<br>         If you do not have any gold, please do not try and play the game.<br>         Remember that luck plays an important part in this game, your maximum luck gets added to the number you role, you currently have <?php echo $  user_row['luck'];?> luck.       </p>        <!-- Input field to place the bet. Minimum is 1, maximum is the amount of gold the character has (must be pulled from database). -->        <script>        function updateTextInput(val) {          document.getElementById('textInput').value=val;        }        </script>       <input type="range" name="bet" min="1" max="<?php $  user_row['gold'];?>" onchange="updateTextInput(this.value);">       <input type="text" id="textInput" value="">       <button id="submit" type="submit" type="button" name="roll">Roll!</button><br>       <!-- If the user has no gold, replace the form (or disable it) with an error stating the user cannot play. -->       <?php         if $  user_row['gold'] >= 1         } else {           $  error = "You have run out of gold, please leave the game room. <a href='index.php'>EXIT</a>";         }       ?>     </form>   </main> ```php  Roll.php ```php   <main>         <!-- The generation of two random numbers from 1 to 20. The first is for the character and the second is for the server.         The character's luck is added to their roll.         The higher number wins, the character's gold increases or decreases appropriately and is saved to the database.         There should be some indication of which is the winning number (i.e. change in colour or pointer).         In the event of a tie, there is no change in the characters gold. -->         <?php         if(isset($  _POST['roll']))         {         $  dice = $  _POST['dice'];         $  rand = rand(1,20);         if($  dice == $  rand)         {             echo "<br>" . "Congratulations you have rolled the number " . $  rand . "which is higher than my own roll, you have earned yourself bonus gold!";         }              echo "<br>" . "Oh, bummer traveler, it seems that you rolled " . $  dice . "which is a lower number than " . $  rand . ", I have taken the liberty of taking out some of your gold. Better luck next time!";         }         ?>       </figcaption>     </figure>     <div class=dice>       <img src="d20.png">     </div>     <p>You now have <?php echo $  user_row['gold']; ?> gold.</p>     <!-- A link back to index.php so the user can play again. -->     <!-- If the character has no gold left, display an error stating the user cannot play. -->     <a href='bet.php'>Play again?</a>     <?php       if $  user_row['gold'] >= 1         echo "You still have some gold left, why not try and earn yourself some more extra pocket change.";       } else {         $  error = "You have run out of gold, please leave the game room. <a href='index.php'>EXIT</a>";       }     ?>   </main> ```php  On the bet.php page a have this code, I don't know how to make the max bet the amount of gold currently in the database, and if the user has less than 1 gold they get kicked out/locked out of playing the game.  This is roll.php here is where I'm having trouble creating the dice roll itself, and I don't know how to add luck to the number that the player would roll.  Even the code I've already tried to put in is probably wrong, as mentioned I'm very weak when it comes to PHP, any help at all is greatly appreciated. 

How do I, as a player, encourage my fellow players to role play?

I am a player in a group of 5 +1 dm. Three of them are wonderful, as well as the DM. They role play, provide commentary, and are great sports when it comes to the game.

The last two are a bit more problematic. They don’t seem to know how good the game is when you actually act, rather than simply stating “I.. [generic action]” followed by an immediate die roll without prompt from the DM. Allow me to clarify.

The first one is energized, and is the kind of person that is always everything everywhere just because. Normally I don’t have a problem with those who won’t stop talking, but he will not stop cracking inappropriate jokes (usually on the subjects of porn and the like), even after every player collectively has told him it’s an issue. Simply put; one who does not take the game seriously, and is rather crude.

The second one is a phone-looker. The ONLY time that he looks away from his phone is when it’s his turn in combat. I’m not embellishing at all, most of the time, he’s not even at the table. I talked to the DM and he agrees it’s a problem, but the DM is far too shy and frankly a big pushover to speak up.

With the two types of players above, how do I, as a player, NOT a DM, shape them up to enjoy the game more via more serious participation? Please note I’m not looking for suggestions to give to my DM, but rather actions that I as a player can take initiative on. Answers involving both me and the DM are applicable, but they should hinge on an integral part by the player.

For reference, we’re running Dungeon of the Mad Mage in D&D 5e.

Android fragmentation: What’s designer’s role? [on hold]

I’m working on a research of understanding Android designer-developer collaboration, and particularly interested in learning whether and how designers and developers work together to solve Android fragmentation problems (e.g., when fragmentation problems are brought up and how these problems are communicated between designers and developers).

But before jumping into my questions, I want to first validate the assumption that designers are actively involved in the process of dealing with fragmentation issues with developers. Is it true?

  • Do designers even care about fragmentation?

  • Do developers think it’s necessary to involve designers?

  • Would designer’s involvement help reduce some of developers’ workload, and build better user experience for their app?

It might be different among different teams and products, so I want to open a discussion and see how everyone practices in their work.

Thank you very much for your contribution!

how to fetch particular role data names from json file swift [on hold]

[ {     "id": 7,     "role": "risk_owner",     "Name": "Sushma rana" }, {     "id": 8,     "role": "risk_owner",     "Name": "lal amt" }, {     "id": 41,     "role": "risk_moderator",     "Name": "username lastname" }, {     "id": 42,     "role": "control_owner",     "Name": "user 2"}] 

The above API Response I want to get name’s who all are having ‘role’ of “risk_owner and control owner”

private func updateActionOwnerFunction(){     for index in 0..<rideList.count{         let json = rideList[index] as! JSON         if (json["role"].stringValue.contains ("risk_tracker_action_owner control_owner risk_tracker_moderator risk_moderator risk_tracker_owner")){                  actionOwnerName.append(json["Name"].stringValue)         }else{             print("not role")         }             setupActionOwnerDropDown()        } 

** I tried this way not useful help me **

Magento 2.3 Admin Panel Edit Role Error

I was trying to edit a user role (System -> Permission -> User Roles) on the magento 2.3.1 admin panel and I started to get this error:

[2019-06-17 08:34:01] main.CRITICAL: Item (Magento\User\Model\User\Interceptor) with the same ID "11" already exists. [] [] [2019-06-17 08:34:01] main.CRITICAL: The "adminhtml.user.editroles" block threw an exception, and it can't be rendered. [] [] 

I’ve tried to google the issue and I’ve seen similar errors relating to products, however, nothing to do with user roles.

The result of this error is that I see a mostly blank page with no ability to edit the assets that a role has access to.

Appreciate any help.

What should happen when a player does not follow his class at all? (i.e. plays his role badly)

I have a player who created a Druid and is mostly playing like a barbarian in combat and like a rogue the rest of the time.

This means he kills animals, does not care for plants, does not use his magic even when someone could use Cure Wounds… (although that last one is certainly okay for a neutral character.)

And when in the presence of an NPC that looks rich, multiple attempts to steal as much as possible from it (like a level 1 character should steal from a cloud giant…)

What would you do in this situation? I’m playing 5e and am allowing all extensions so the characters can multi-class. On my end, I was thinking to force him to choose another class once at level 2. Would that be wise? I think that would be much more likely to teach him a lesson rather than letting him continue as this barbarian/rogue under the disguise of a druid…

To answer the first comment fully:

PHB p64. under Power of Nature

Druids revere nature above all.

So being the first to kill everything, including animals, seems quite contradictory to the class already… (were he evil, I could understand that he like monstrosities, and not “regular” animals, but that is not the case here.)

PHB p64. under Preserve The Balance

Already the title sounds like a Druid seeking just gold and gems and other riches is not going to help much in preserving the balance…

[…] Druids oppose cults of Elemental Evil and others who promote to the exclusion of others.

Gold and gems could be viewed as promoting the Earth Elemental.

Druids are also concerned with the delicate ecological balance that sustains plant and animal life, and the need for civilized folk to live in harmony with nature, not in opposition to it.

This re-enforces my first excerpt.

PHB p65. under Creating A Druid

When making a druid, consider why your character has such a close bond with nature.

I will say, Barbarian are considered to be close to nature as well… so a barbaric fighting aspect may not be too far off from a Druid’s devotion. Plus Druids may fight like Barbarian when their territory is at risk.

Now… looking at the Circle of the Moon, I guess I could force him to join that circle rather than the other one made of mystics and sages.

How to let non-admin Role Approve comments?

I’m looking for a way to allow a non-admin user Role to Approve comments.

I thought a Flag/Rules combination might be a solution but I can’t figure it out.

I added a content-moderator role, then I created a view listing comments awaiting moderation

After that i setup a flag to Approve comments and added the flag link within the view.
The thing is there is no Rules action that approves comments once the flag is clicked.

Any ideas ?

Assign user capabilities to a Custom User Role not working

I have a New User role called client admin. This role must create, list, edit, delete, remove user for the site. I add the following code the Site.

    add_role(     'client_admin',     __( 'Client Admin' ),     array( 'create_users'            => true, 'list_users'                => true,  'edit_users'                => true, 'delete_users'            => true, 'remove_users'            => true, 'promote_users'           => true, ) ); 

I go to ***/wp-admin/users.php login in as the client admin the site say

“You need a higher level of permission.”

User Role does work and all other capabilities for the role is working fine.

What am I missing ?

Limit the number of uploads per image field depending of role

I need a hook (or something similar) where I can set the number of image uploads depending of the role of the user.

In the settings of the field there is no way to set the maximum number of values users can enter, just one value for all roles. For example, for role #1 I want the users can upload just 3 images, for role #2 just 5 images.

I tried several ways but none worked. I tried using #element_validate but the validation never worked.

Is there some way to do that? I forgot to mention is for Drupal 7.