View Full Version : I'm going to be less active the next week
FreezeWarp
06-23-2008, 04:44 PM
Okay, I just found out now that a spot is open for me in a class my mother is taking. Probably doesn't make any sense, right? Well, basically, my mother is taking a class on Perl programming. There are only two people in the class, and my mother says that the instructor has offered that I sit along and listen. I have been wanting to learn more programming, and I feel this would be a good chance. The class lasts from 8am to 5pm until Friday, so I'll be gone for then. I will likely be fairly inactive at night too, being that I am going to need to get some more sleep.
Anyway, I will be back and kicking come Saturday, so see you then.
Wow.... I can never take a class that lasts that long. Good luck in learning more. That's always good. ;)
BTW - You need to tell PM he needs to be more active and Admin-y.
Shiny Espeon
06-23-2008, 06:17 PM
Dang, you like programming. Have fun at your class!
Shiny Raichu's going to take over the world. At least he's young and likes to learn. He's going to get an AWESOME job and be set for the rest of his life. :D
FreezeWarp
06-23-2008, 06:40 PM
Well, it'd be nice. :D
Shiny Espeon
06-23-2008, 06:47 PM
Omg...if you do take over the world, don't be Hitler!
<_< I love Hitler... XDDD
SR's not that evil. Besides with everything getting computerized, he's doing the right thing.
FreezeWarp
06-26-2008, 06:26 PM
I make scripts!
This one calculates the power of moves:
#!/usr/bin/perl
print "Thanks to Serebii.net for the formula. The random number is set to its average, 100.\n";
print "The formula I will use is Damage = (((2 * Level / 5 + 2) * Attack * Power / Defense) / 50 + 2) * STAB * Weak/Resis\n";
print "This script is still in testing. Don't rely on it, though do give your feedback.\n";
print "Please answer the following questions as instructed. We will try to correct you if you use incorrect formatting, but we will not always.\n";
until ($number) {
print "What is the level of your pokemon? Please enter a one or two digit number.\n";
chomp ($level = <STDIN>);
if ($level =~ /[a-zA-z]/) {
print "Please enter a one or two digit number.\n";
redo;
}
else {
$number = 1;
}
}
$number = 0;
until ($number) {
print "What is the Attack Stat of your pokemon. Make sure you enter the special attack if you are using a special move or the physical attack if it is a pysical move. Make sure you enter only the number.\n";
chomp ($attack = <STDIN>);
if ($attack =~ /[a-zA-z]/) {
print "Please enter only the number of your defense stat, no letters or special characters.\n";
redo;
}
else {
$number = 1;
}
}
$number = 0;
until ($number) {
print "What is the Defense Stat of the opposing pokemon. Make sure you enter the special defense if you are using a special move or the physical defense if it is a pysical move. Make sure you enter only the number.\n";
chomp ($defense = <STDIN>);
if ($defense =~ /[a-zA-z]/) {
print "Please enter only the number of your defense stat, no letters or special characters.\n";
redo;
}
else {
$number = 1;
}
}
$number = 0;
until ($number) {
print "What is the base damage of the attack your using?\n";
chomp ($base = <STDIN>);
if ($base =~ /[a-zA-z]/) {
print "Please enter only the number of the base damage of your attack, no letters or special characters.\n";
redo;
}
else {
$number = 1;
}
}
$number = 0;
$stabmenu = <<MENU;
Please enter one of the following. Be warned, our correction filter isn't as accurate here, so make sure you enter the data correctly.
1 No, they are not the same type.
1.5 Yes, they are the same type.
MENU
until ($number) {
print "Is the attack your using the same type as your pokemon.\n $stabmenu\n";
chomp ($stab = <STDIN>);
if ($stab =~ /[^(1.5|1)]/) {
print "Please enter 1 for no or 1.5 for yes.\n";
redo;
}
else {
$number = 1;
}
}
$number = 0;
$weakresismenu = <<MENU;
Please enter one of the following. Be warned, our correction filter is often wrong here, so make sure you enter the data correctly.
.25 This means that your attack will be only a quarter as strong.
.5 This means that your attack will be only half as strong.
1 This means your attack will not be changed.
2 This means your attack will be twice as strong.
4 This means your attack will be 4 times as strong.
MENU
until ($number) {
print "Compared to normal, how strong will your attack be because of weaknesses and resistances. \n $weakresismenu \n";
chomp ($weakresis = <STDIN>);
if ($weakresis =~ /[^(.25|.5|1|2|4)]/) {
print "Please enter one of the numbers. We may not catch you next time.\n";
redo;
}
else {
$number = 1;
}
}
$number = 0;
print "Here is the formula:\n";
print "Damage = (((2 * $level / 5 + 2) * $attack * $base / $defense) / 50 + 2) * $stab * $weakresis\n";
print "Here is the final result:\n";
$damage = (((2*$level/5+2)*$attack*$base/$defense)/50+2)*$stab*$weakresis;
print "$damage\n";
print "Something doesn't seem right? If you find any bugs or typos in this script please report them to me either by posting in the respective thread at the Pokezam Forums or by emailing me at ShinyRaichu [at] yahoo.com.";
This one converts the temperature:
#!/usr/bin/perl
until ($done) {
print "Enter a temperature to be converted. Make sure it has the C or F at the end so we know how to convery it.\n";
chomp ($a = <STDIN>);
unless ($a =~ /[0-9][fc]/i) {
print "Um... Was I not clear? Enter a temperature with an F or C at the end.\n";
redo;
}
else {
$done = 1;
$print = "Okay, just a moment \n \n \n \n \n \n";
}n
}
$done = 0;
$c = (chop ($a));
$fartocel = ($a-32)*5/9;
$celtofar = $a*9/5+32;
if ($c =~ /[Ff]/) {
$temp = $fartocel;
$name = Celsius;
}
else {
$temp = $celtofar;
$name = Fahrenheit;
}
print "Okay, I have figured out that the temperature you entered when converted to $name is $temp.\n";
This one is a fun little numbers script:
#!/usr/bin/perl
until ($num) {
print "Enter 3 numbers\n";
chomp ($a = <STDIN>);
if ($a =~ /[a-zA-Z]/) {
print "Consider going back to preschool. A number!\n";
redo;
}
else {
$num = 1;
print "Okay, two more please\n";
}
}
$num = 0;
until ($num) {
print "Enter two numbers\n";
chomp ($b = <STDIN>);
if ($b =~ /[a-zA-z]/) {
print "Okay, you know what a number is, so enter one\n";
redo;
}
else {
$num = 1;
print "Okay, just one more now.\n";
}
}
$num = 0;
until ($num) {
print "Enter a number.\n";
chomp ($c = <STDIN>);
if ($c =~ /[a-zA-Z]/) {
print "You entered a number the first two times. So enter one this time please.\n";
redo;
}
else {
$num = 1;
print "Thank you, now I got to tell you about them numbers. I ain't too good at math, so I guess I'll have that them there perl help you instead.\n";
}
}
$num = 0;
$sum = $a+$b+$c;
$prod = $a*$b*$c;
$av = $sum/3;
@a = ($a, $b, $c);
@b = sort @a;
$high = $b[0];
$mid = $b[1];
$low = $b[2];
print "The sum of what you entered is $sum\n";
print "The product of what you entered is $prod\n";
print "The highest number you entered is $high\n";
print "The lowest number you entered is $low\n";
print "The middle number you entered is $mid\n";
print "The average of your numbers is $av\n";
Omg...if you do take over the world, don't be Hitler!
SR can take over the world, just don't take over the moon--- That's My Domain!
But yeah, I wish you luck in your goals, SR. I know you're gonna be somthin someday-- you're so smart, and you're a good leader... keepin the forums stable is pretty tough...
Kaboom
06-27-2008, 08:42 AM
OMG Perl looks so complicated! I think I'll stick with PHP... and I'll do those scripts too!
EDIT: Here's the damage calculator in PHP, made so that it can be used as a tool. You can adapt the function to make it into a script, as I will be doing for PokéBattlers.
<?php
// calculates damage from stats
// Damage = (((2 * Level / 5 + 2) * Attack * Power / Defense) / 50 + 2) * STAB * Weak/Resis
// Formula from Serebii.net
// Script by Adam Haskell (C) 2008
function calcDamageFromGET( $returntype) {
// process the equation
// GET vars
$lev = intval( $_GET['lev']);
$atk = intval( $_GET['atk']);
$pow = intval( $_GET['pow']);
$def = intval( $_GET['def']);
$stab = floatval( $_GET['stab']);
$wr = floatval( $_GET['wr']);
// check values are correct
$err = Array();
if( $lev <= 0 || $lev > 100) $err[]="Level out of bounds!";
if( $atk <= 0) $err[]="Attack out of bounds!";
if( $pow <= 0) $err[]="Power out of bounds!";
if( $def <= 0) $err[]="Defence out of bounds!";
if( $stab != 1 & $stab != 1.5) $err[]="STAB out of bounds!";
if( $wr != 0.25 && $wr != 0.5 && $wr != 1 && $wr != 2 && $wr != 4) $err[]="Weak/Res out of bounds!";
if( count( $err) != 0) {
$errstr = "The following error(s) occured: <ul>";
foreach( $err as $e) $errstr.="<li>".$e."</li>";
$errstr .= "</ul>Check values";
trigger_error( $errstr, E_USER_WARNING);
return false;
}
// calculate formula and return
$damage = (((2*$lev/5+2)*$atk*$pow/$def)/50+2)*$stab*$wr;
return Array( "lev"=>$lev, "atk"=>$atk, "def"=>$def, "pow"=>$pow, "stab"=>$stab, "wr"=>$wr, "damage"=>$damage);
}
if( !isset( $_GET['method'])) {
// form has not yet been submitted
?>
<!DOCTYPE HTML>
<head>
<title>Damage Calculator</title>
</head>
<body>
Hover over a name for help. Note that Attack and Defence should be Sp.Atk and Sp.Def if the attack used is of the Special type.
<form method="GET" action="damage.php">
<input type="hidden" name="method" value="display">
<table>
<tr><td title="What is the user's Level?">Level</td> <td><input type="text" name="lev"></td></tr>
<tr><td title="What is the user's Attack stat?">Attack</td> <td><input type="text" name="atk"></td></tr>
<tr><td title="What is the foe's Defence stat?">Defence</td> <td><input type="text" name="def"></td></tr>
<tr><td title="What is the base Power of the attack?">Power</td> <td><input type="text" name="pow"></td></tr>
<tr><td title="Is the attack of the same type as the user?">STAB</td> <td><select name="stab"><option value="1">No STAB</option> <option value="1.5">STAB</option></select></td></tr>
<tr><td title="How weak or resistant is the foe's type to the attack?">Weak/Res</td> <td><select name="wr"><option value="0.25">Double resistance</option> <option value="0.5">Resistance</option> <option value="1" selected>Neutral</option> <option value="2">Weakness</option> <option value="4">Double weakness</option></select></td></tr>
<tr><td colspan=2 style="text-align: center"><input type="submit" value="Calculate"></td></tr>
</table>
</form>
<div style="text-align: right; font-size: 10pt">© Adam Haskell 2008</div>
</body>
</html>
<?php
}
else {
// output data for this calculation
$details = calcDamageFromGET("array");
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Damage Calculator</title>
</head>
<body>
The given values were:
<ul><li>Level: <?php echo $details['lev'] ?></li>
<li>Attack: <?php echo $details['atk'] ?></li>
<li>Defence: <?php echo $details['def'] ?></li>
<li>Power: <?php echo $details['pow'] ?></li>
<li>STAB: <?php echo $details['stab'] ?></li>
<li>Weak/Res: <?php echo $details['wr'] ?></li></ul>
The resulting damage for this attack is: <?php echo $details['damage'] ?>HP.
<hr>
<a href="damage.php">Click here to simulate another attack</a>
<div style="text-align: right; font-size: 10pt">© Adam Haskell 2008</div>
</body>
</html>
<?php
} ?>
btw SR, we could have a thread where we both do the same script, you in Perl and me in PHP, and see what they look like compared to each other. Just a thought, but it could be interesting.
FreezeWarp
06-27-2008, 02:47 PM
keepin the forums stable is pretty tough...
And it might be getting tougher, though if I told you what I mean, I'd be in hot water.
OMG Perl looks so complicated! I think I'll stick with PHP... and I'll do those scripts too!
EDIT: Here's the damage calculator in PHP, made so that it can be used as a tool. You can adapt the function to make it into a script, as I will be doing for PokéBattlers.
<?php
// calculates damage from stats
// Damage = (((2 * Level / 5 + 2) * Attack * Power / Defense) / 50 + 2) * STAB * Weak/Resis
// Formula from Serebii.net
// Script by Adam Haskell (C) 2008
function calcDamageFromGET( $returntype) {
// process the equation
// GET vars
$lev = intval( $_GET['lev']);
$atk = intval( $_GET['atk']);
$pow = intval( $_GET['pow']);
$def = intval( $_GET['def']);
$stab = floatval( $_GET['stab']);
$wr = floatval( $_GET['wr']);
// check values are correct
$err = Array();
if( $lev <= 0 || $lev > 100) $err[]="Level out of bounds!";
if( $atk <= 0) $err[]="Attack out of bounds!";
if( $pow <= 0) $err[]="Power out of bounds!";
if( $def <= 0) $err[]="Defence out of bounds!";
if( $stab != 1 & $stab != 1.5) $err[]="STAB out of bounds!";
if( $wr != 0.25 && $wr != 0.5 && $wr != 1 && $wr != 2 && $wr != 4) $err[]="Weak/Res out of bounds!";
if( count( $err) != 0) {
$errstr = "The following error(s) occured: <ul>";
foreach( $err as $e) $errstr.="<li>".$e."</li>";
$errstr .= "</ul>Check values";
trigger_error( $errstr, E_USER_WARNING);
return false;
}
// calculate formula and return
$damage = (((2*$lev/5+2)*$atk*$pow/$def)/50+2)*$stab*$wr;
return Array( "lev"=>$lev, "atk"=>$atk, "def"=>$def, "pow"=>$pow, "stab"=>$stab, "wr"=>$wr, "damage"=>$damage);
}
if( !isset( $_GET['method'])) {
// form has not yet been submitted
?>
<!DOCTYPE HTML>
<head>
<title>Damage Calculator</title>
</head>
<body>
Hover over a name for help. Note that Attack and Defence should be Sp.Atk and Sp.Def if the attack used is of the Special type.
<form method="GET" action="damage.php">
<input type="hidden" name="method" value="display">
<table>
<tr><td title="What is the user's Level?">Level</td> <td><input type="text" name="lev"></td></tr>
<tr><td title="What is the user's Attack stat?">Attack</td> <td><input type="text" name="atk"></td></tr>
<tr><td title="What is the foe's Defence stat?">Defence</td> <td><input type="text" name="def"></td></tr>
<tr><td title="What is the base Power of the attack?">Power</td> <td><input type="text" name="pow"></td></tr>
<tr><td title="Is the attack of the same type as the user?">STAB</td> <td><select name="stab"><option value="1">No STAB</option> <option value="1.5">STAB</option></select></td></tr>
<tr><td title="How weak or resistant is the foe's type to the attack?">Weak/Res</td> <td><select name="wr"><option value="0.25">Double resistance</option> <option value="0.5">Resistance</option> <option value="1" selected>Neutral</option> <option value="2">Weakness</option> <option value="4">Double weakness</option></select></td></tr>
<tr><td colspan=2 style="text-align: center"><input type="submit" value="Calculate"></td></tr>
</table>
</form>
<div style="text-align: right; font-size: 10pt">© Adam Haskell 2008</div>
</body>
</html>
<?php
}
else {
// output data for this calculation
$details = calcDamageFromGET("array");
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Damage Calculator</title>
</head>
<body>
The given values were:
<ul><li>Level: <?php echo $details['lev'] ?></li>
<li>Attack: <?php echo $details['atk'] ?></li>
<li>Defence: <?php echo $details['def'] ?></li>
<li>Power: <?php echo $details['pow'] ?></li>
<li>STAB: <?php echo $details['stab'] ?></li>
<li>Weak/Res: <?php echo $details['wr'] ?></li></ul>
The resulting damage for this attack is: <?php echo $details['damage'] ?>HP.
<hr>
<a href="damage.php">Click here to simulate another attack</a>
<div style="text-align: right; font-size: 10pt">© Adam Haskell 2008</div>
</body>
</html>
<?php
} ?>btw SR, we could have a thread where we both do the same script, you in Perl and me in PHP, and see what they look like compared to each other. Just a thought, but it could be interesting.
Indeed. I'm not going to start it though you can feel free to. I can't spend all my time on perl, naturally, though I can spend some. I will be showing off some of my scripts in the SR's work forum, however.
Kaboom
06-27-2008, 02:50 PM
OK, and I'll be posting scripts in my Tutorials thread.
FreezeWarp
07-01-2008, 02:47 PM
Just so everyone knows I'm going to be giving PHP a shot with some online tutorials. So I'll be less active while learning that as well. I may not be able to, though I friend says its easier than perl so I should give it a shot.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.