Jump to content

Recommended Posts

I've managed to make a skill calculator for a game I play.

 

However, I want each of the iterations to be highlighted in green in a player can do it, and red if not. Then Yellow if they will be able to do it by the time they reach their goal.

 

However, everyones experiences differs.

 

Level 1 - 0 Exp

Level 2 - 83 Exp

Level 3 - 174 Exp

Level 4 - 276 Exp

 

and so on. A player can have any experience between these levels. such as 182, this would be level 3. So if an iteration required Level 4, they couldn't do it so I would like Level 4 to be highlighted red.

 

So I need the code to figure out which level they are from the experience they give, then highlight the iterations accordingly. I will show you the calculator I've coded, however, I don't want to publicly post it.

 

Thanks

~Karl

Link to comment
https://forums.phpfreaks.com/topic/180648-solved-skill-calculators/
Share on other sites

im not sure if i just read your post wrong but this should be very simple. you can use a simple if block:

 

if($user_xp < 83){
level one
} elseif($user_xp >= 83 && $user_xp < 174){
level two
} elseif($user_xp >= 174 && $user_xp < 276){
level 3
} 

 

You would just do what you needed to do inside of each block

Following on from what you put, I want each thing to highlight according to whether or not a player can do the iteration or not.

 

In theory, this should work:

if($arr['level'] <= $level) {
$colour = "24ff00";
} elseif ($arr['level'] > $level){
$colour = "ff0000";
}

 

$arr['level'] is the level required, which is taken from a database. However, it highlights it all green at the moment, even if a player cannot do the task.

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.