...

View Full Version : Xp Calculator - Converting Levels to Xp



fantasy_guy
09-23-2003, 09:38 PM
Okay, I'm new to PHP coding...I'm creating a simple experience calculator for a game - I have the basic coding down, but I need to know how to convert the level given, into experience. My arrays are set up as follows:

$level = array (
array ( xp="0",
level=>"1",
array ( xp="83",
level=>"2",
array ( xp="176",
level=>"3",

and etc...Is it possible to have the input point to a certain array in the set to change the input to experience, or do I need to do something else?

~The Fant :)

firepages
09-24-2003, 07:08 AM
I dont really know what you want to do so this is probably not relevant to your problem .. eg calculator ? what are we calculating ?

for display this may work though.



<?php

$level =array(
1=>array('xp'=>0 , 'label'=>'zip diddly') ,
2=>array('xp'=>83 , 'label'=>'apprentice yak') ,
3=>array('xp'=>176 , 'label'=>'oodles') ,
4=>array('xp'=>10000 , 'label'=>'spooksteresque')
);

$selected = 2 ;

echo 'experience required for level '
. $selected .' ( '. $level[$selected]['label'] .' ) = '
.$level[$selected]['xp']
;
?>

fantasy_guy
09-26-2003, 02:19 AM
Actually, that does help. O_o

Thanks!

~The Fant :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum