Jump to content

Web Design/Web based scripting


dsavi

Recommended Posts

So, what should I move on to after JS, which I've already kind of started on, and have a very basic understanding of? Should I try PHP? Is ASP .NET worth learning, or will having a good knowledge of PHP be better than wasting time learning ASP.NET?

 

 

 

Also, I'd be very happy if someone with some experience in it could help me with questions on setting up a web server (using Linux, not shelling out the cash for Windows 2008 Server), or FTP server. Anyone who knows of good cheap hosting if that doesn't work out would be nice too.

 

PHP and ASP.Net are very different, but each have there advantages.

 

PHP is free and is based on C making it easy for people to convert to php.

 

ASP is a paid for product (ok not the coding but the hosting/licensing is) and is based on either JavaScript or VB (depending on the style you pick).

 

Personally I can code a some VB.Net, C++, JavaScript, ASP and PHP. Out of the 2 (asp and php) I find php easier to code and have more functions. I find ASP to be easy to limited on the VB side.

 

 

 

Most people will tell you ASP is for business, PHP is for hobbyists. To a degree its about right, but more companies are using with PHP then before.

 

 

 

Overall without it has to be in ASP, I would pick PHP anyday.

 

 

 

As for Errdoth's code I'm guessing it would be manipulating the sql query (group by FTW). But I hate sorting arrays without I have to.

[hide=Drops]

  • Dragon Axe x11
    Berserker Ring x9
    Warrior Ring x8
    Seercull
    Dragon Med
    Dragon Boots x4 - all less then 30 kc
    Godsword Shard (bandos)
    Granite Maul x 3

Solo only - doesn't include barrows[/hide][hide=Stats]

joe_da_studd.png[/hide]

Link to comment
Share on other sites

  • Replies 78
  • Created
  • Last Reply

Top Posters In This Topic

Seeing as Google and Yahoo! use PHP extensively in their products, I wouldn't really say it's just for hobbyists either. I'm not sure why ASP/.net is in such widespread use, given how efficient PHP is in terms of price, processor power and the time it takes to learn/write it.

C2b6gs7.png

Link to comment
Share on other sites

I'm not sure why ASP/.net is in such widespread use, given how efficient PHP is in terms of price, processor power and the time it takes to learn/write it.

 

I've never understood that either, though I really am not a fan of proprietary software in general, especially when there are alternatives that do the same thing better (I mean, I still prefer PS to Gimp and DW to bluefish, but it's not like they have _all_ of the functions their proprietary equivalents do)

 

 

 

And Joe, I couldn't actually do it just in the query, as mysql won't order them naturally (like if I ordered it by stat is would pull 1, 10, 2, 3....) and the item stats table is separate from the regular items table (don't ask me why, I didn't make it :| ) so I had to pull all of that stats from the stats table, shove them into an array with some of the info from the items table, (it's like $stats[$i]['whatever'] for all of the stats) and then sort the entire array by what the user selected (like $stats[$i (item id)]['attack_stab'] and the entire thing had to be naturally ordered by the value of ['attack stab']. [/bragging] :P

Link to comment
Share on other sites

Does anyone have something that will turn RS experience into levels? I can't be bothered to write the 350 or so lines of PHP that would do that.

 

 

 

Since our JScript function can be accessed by anyone who can View Souce and follow a URL, I may as well give you the PHP conversion I made for the dynamic sigs.

 

 

 

// Returns the level based on the amount of experience, converted from Tip.It's JScript function

function exp2level($exp) {

$output = "0";

$points = "0";

for ($lvl = 1; $lvl <= 150; $lvl++) {

	$points += floor($lvl + 300 * pow(2, $lvl / 7));

	if ($lvl >= 1) {

		if ($output > $exp) {

			$lvl -= 1;

			if (!$lvl) {

				return "1";

			}

			elseif ($lvl > 99) {

				return "99";

			}

			else {

				return $lvl;

			}

		}

		$output = floor($points / 4);

	}

}

return "1";

}

 

 

 

Might post some other useful functions later.

Link to comment
Share on other sites

Thanks. :D

 

I'm going to see if I can convert Tipit's combat calculator into PHP now that someone linked to the thread with the Java converter.

 

Might have to ask my sister (Who does Java, she never has been a really girly girl :P) my Java skills are a bit... Lacking... To say the least.

C2b6gs7.png

Link to comment
Share on other sites

Thanks. :D

 

I'm going to see if I can convert Tipit's combat calculator into PHP now that someone linked to the thread with the Java converter.

 

Might have to ask my sister (Who does Java, she never has been a really girly girl :P) my Java skills are a bit... Lacking... To say the least.

 

 

 

The combat formula is already public in about 4 different languages on RSOF and that's the same one we use.

Link to comment
Share on other sites

Oh well, I could still use the practice. :P

 

Edit: Was easier than I thought.

 

<?php

function levelsToCombat($attack = '1', $strength = '1', $defense = '1', $hitpoints = '10', $ranged = '1', $magic = '1', $prayer = '1', $summoning = '1')

{

    $combat = ($defense + $hitpoints + floor($prayer / 2) + floor($summoning / 2)) * 0.25;



    $warrior = ($attack + $strength) * 0.325;

    $ranger = $ranged * 0.4875;

    $mage = $magic * 0.4785;



    return $combat + max($warrior, max($ranger, $mage));

}

?>

C2b6gs7.png

Link to comment
Share on other sites

Thanks. :D

 

I'm going to see if I can convert Tipit's combat calculator into PHP now that someone linked to the thread with the Java converter.

 

Might have to ask my sister (Who does Java, she never has been a really girly girl :P) my Java skills are a bit... Lacking... To say the least.

 

Click for Java Knowledge.

 

 

 

Seriously, go to that link and look through the book. It's the complete online version of the book I'm using to learn Java.

 

Link to PHP code? Think that's what you want.

[hide=Funny Quotes]

So you sucker punched a kid in the back of the head? Good job.
What scares me is that you're like 10 years old.
-.- im not that freaking young
You were a couple years ago.
It's not racist if its true.
Hmm... I wonder how one goes about throwing someone out a window in a mystic fashion :-k

 

The mental image for that is freaking awesome.

[/hide]

- I dont need to "get a life." I'm a gamer - I have LOTS of lives!

Link to comment
Share on other sites

Not going to release my caching code for stats or calculating missing stats but here is some code I wrote that retrieves a given user's stats and then parses them into nice multidimensional arrays.

 

 

 

Simply call get_stats_hs(runescape_name) and if it returns an array then it has stats for you, if not it means the script couldn't contact the website at all. If the user doesn't exist in the high scores at all it will generate a fake set of scores for them. Don't call parse_stats(), that's used by get_stats_hs() to parse the output into something useful.

 

 

 

// This function retrieves stats from the RuneScape database

function get_stats_hs($rsn) {

$curl_getstats = curl_init();

curl_setopt($curl_getstats, CURLOPT_URL, 'http://hiscore.runescape.com/index_lite.ws?player='.$rsn);

curl_setopt($curl_getstats, CURLOPT_BINARYTRANSFER, 1);

curl_setopt($curl_getstats, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl_getstats, CURLOPT_CONNECTTIMEOUT, 3);

curl_setopt($curl_getstats, CURLOPT_TIMEOUT, 6);

ob_start();

$curl_return_stats =  curl_exec($curl_getstats);

ob_end_clean();

$curl_http_return = curl_getinfo($curl_getstats, CURLINFO_HTTP_CODE);

curl_close($curl_getstats);

if ($curl_http_return == '404') {

	// If we 404'ed then the user has no ranks for anything, make some fake vars and parse them		 

	$i = 0;

	while ($i < 25) {

		$fakestats .= "-1,-1,-1\n";

		$i++;

	}

	$fakestats .= "-1,-1\n-1,-1\n-1,-1\n-1,-1";

	return parse_stats($fakestats);

}

elseif ($curl_http_return == '0') {

	// If it's 0 then connection between us and the high scores has failed

	return 0;

}

else {

 	return parse_stats($curl_return_stats);

}

}



// This function processes a one line string of stats and returns them (usually read from high scores)

function parse_stats($stats_unparsed) {

$skillarray = array('overall', 'attack', 'defence', 'strength', 'hitpoints', 'range', 'prayer', 'magic', 'cooking', 'woodcutting', 'fletching', 'fishing', 'firemaking', 'crafting', 'smithing', 'mining', 'herblore', 'agility', 'thieving', 'slayer', 'farming', 'runecrafting', 'hunter', 'construction', 'summoning', 'duel', 'bh', 'bhr', 'fog');

$eachskill = explode("\n", $stats_unparsed);

$i = 0;

while ($i < count($skillarray)) {

 	$holdvar = explode(',', $eachskill[$i]);

	$stats[$skillarray[$i]]['rank'] = $holdvar[0];

	$stats[$skillarray[$i]]['level'] = $holdvar[1];

	if (!in_array($skillarray[$i], array('duel', 'bh', 'bhr', 'fog'))) {

		$stats[$skillarray[$i]]['exp'] = $holdvar[2];

	}

	$i++;

}

return $stats;

}

 

 

 

Example usage:

 

$examplestats = get_stats_hs('pure_mageuk');

print_r($examplestats);

 

 

 

Output:

 

Array

(

   [overall] => Array

       (

           [rank] => 21925

           [level] => 1932

           [exp] => 153138706

       )



   [attack] => Array

       (

           [rank] => 6234

           [level] => 99

           [exp] => 20318944

       )



   [defence] => Array

       (

           [rank] => 12092

           [level] => 99

           [exp] => 14570796

       )



   [strength] => Array

       (

           [rank] => 14383

           [level] => 99

           [exp] => 15574943

       )



   [hitpoints] => Array

       (

           [rank] => 11341

           [level] => 99

           [exp] => 19124520

       )



   [range] => Array

       (

           [rank] => 17273

           [level] => 99

           [exp] => 13403123

       )



   [prayer] => Array

       (

           [rank] => 4103

           [level] => 99

           [exp] => 13069751

       )



   [magic] => Array

       (

           [rank] => 6350

           [level] => 99

           [exp] => 14409376

       )



   [cooking] => Array

       (

           [rank] => 40524

           [level] => 99

           [exp] => 13056394

       )



   [woodcutting] => Array

       (

           [rank] => 477567

           [level] => 75

           [exp] => 1286046

       )



   [fletching] => Array

       (

           [rank] => 34953

           [level] => 99

           [exp] => 13072220

       )



   [fishing] => Array

       (

           [rank] => 836176

           [level] => 63

           [exp] => 368644

       )



   [firemaking] => Array

       (

           [rank] => 33996

           [level] => 86

           [exp] => 3602110

       )



   [crafting] => Array

       (

           [rank] => 13325

           [level] => 85

           [exp] => 3282738

       )



   [smithing] => Array

       (

           [rank] => 146892

           [level] => 65

           [exp] => 477729

       )



   [mining] => Array

       (

           [rank] => 936562

           [level] => 60

           [exp] => 299688

       )



   [herblore] => Array

       (

           [rank] => 23725

           [level] => 76

           [exp] => 1336543

       )



   [agility] => Array

       (

           [rank] => 66057

           [level] => 70

           [exp] => 738153

       )



   [thieving] => Array

       (

           [rank] => 22207

           [level] => 80

           [exp] => 1996524

       )



   [slayer] => Array

       (

           [rank] => 132610

           [level] => 66

           [exp] => 520507

       )



   [farming] => Array

       (

           [rank] => 52881

           [level] => 66

           [exp] => 529116

       )



   [runecrafting] => Array

       (

           [rank] => 49170

           [level] => 67

           [exp] => 557174

       )



   [hunter] => Array

       (

           [rank] => 273207

           [level] => 53

           [exp] => 144841

       )



   [construction] => Array

       (

           [rank] => 10379

           [level] => 75

           [exp] => 1237681

       )



   [summoning] => Array

       (

           [rank] => 84585

           [level] => 54

           [exp] => 161145

       )



   [duel] => Array

       (

           [rank] => -1

           [level] => -1

       )



   [bh] => Array

       (

           [rank] => -1

           [level] => -1

       )



   [bhr] => Array

       (

           [rank] => -1

           [level] => -1

       )



   [fog] => Array

       (

           [rank] => -1

           [level] => -1

       )



)

 

 

 

No idea if that's useful to anyone.

Link to comment
Share on other sites

Now if only this knowledge couldb e used so that links posted in posts/topics are opened in a new window... :-#

 

 

 

How about NO? I hate new windows...Unless, of course, you mean to make it an option to open it in a new window or a new tab.

 

 

 

And to dsavi_x4 - Sorry, but it seemed useful, and at least a bit close. At least I tried...lol.

[hide=Funny Quotes]

So you sucker punched a kid in the back of the head? Good job.
What scares me is that you're like 10 years old.
-.- im not that freaking young
You were a couple years ago.
It's not racist if its true.
Hmm... I wonder how one goes about throwing someone out a window in a mystic fashion :-k

 

The mental image for that is freaking awesome.

[/hide]

- I dont need to "get a life." I'm a gamer - I have LOTS of lives!

Link to comment
Share on other sites

Link to the article mentioning the change..I think...

 

 

 

I'm not sure if that's what ya'll are looking for, considering I don't know phpbb3 or anything, but the

!-- BEGIN url -->{DESCRIPTION}

looked promising to me...After I set up my home server I'll work on php, so don't yell at me if I got it wrong lol...

[hide=Funny Quotes]

So you sucker punched a kid in the back of the head? Good job.
What scares me is that you're like 10 years old.
-.- im not that freaking young
You were a couple years ago.
It's not racist if its true.
Hmm... I wonder how one goes about throwing someone out a window in a mystic fashion :-k

 

The mental image for that is freaking awesome.

[/hide]

- I dont need to "get a life." I'm a gamer - I have LOTS of lives!

Link to comment
Share on other sites

Link to the article mentioning the change..I think...

 

 

 

I'm not sure if that's what ya'll are looking for, considering I don't know phpbb3 or anything, but the

!-- BEGIN url -->{DESCRIPTION}

looked promising to me...After I set up my home server I'll work on php, so don't yell at me if I got it wrong lol...

 

meh, works just as well, and it's not JS.

Link to comment
Share on other sites

 

 

 

What do you have against JS?

[hide=Funny Quotes]

So you sucker punched a kid in the back of the head? Good job.
What scares me is that you're like 10 years old.
-.- im not that freaking young
You were a couple years ago.
It's not racist if its true.
Hmm... I wonder how one goes about throwing someone out a window in a mystic fashion :-k

 

The mental image for that is freaking awesome.

[/hide]

- I dont need to "get a life." I'm a gamer - I have LOTS of lives!

Link to comment
Share on other sites

I can't believe people actually do that, unless they're browsing from a cell phone or something.

 

Well, put it this way:

 

Cons of using JS: Small percentage of people will be unable to use it properly

 

Cons of using target attrib: None

 

 

 

No cons are better than even a small one :|

 

 

 

As long as you aren't saying JS is bad in general, you're fine. If you are, then I'll probably have to...well..on here, probably yell at you in a foreign language is about as bad as I could do...lol.

 

 

 

But, I do see your point. And I did read about the target attribute thing, but I figured that the other code was more...idk how to explain it.

 

 

 

And in any case, doesn't Tip.It require JS for like the main page anyways? So, there would be no problem, right?

[hide=Funny Quotes]

So you sucker punched a kid in the back of the head? Good job.
What scares me is that you're like 10 years old.
-.- im not that freaking young
You were a couple years ago.
It's not racist if its true.
Hmm... I wonder how one goes about throwing someone out a window in a mystic fashion :-k

 

The mental image for that is freaking awesome.

[/hide]

- I dont need to "get a life." I'm a gamer - I have LOTS of lives!

Link to comment
Share on other sites

I can't believe people actually do that, unless they're browsing from a cell phone or something.

 

Well, put it this way:

 

Cons of using JS: Small percentage of people will be unable to use it properly

 

Cons of using target attrib: None

 

 

 

No cons are better than even a small one :|

 

 

 

As long as you aren't saying JS is bad in general, you're fine. If you are, then I'll probably have to...well..on here, probably yell at you in a foreign language is about as bad as I could do...lol.

 

 

 

But, I do see your point. And I did read about the target attribute thing, but I figured that the other code was more...idk how to explain it.

 

 

 

And in any case, doesn't Tip.It require JS for like the main page anyways? So, there would be no problem, right?

 

Personally i agree with errdoth and where in there did he say it is bad? I have worked with errdoth on projects before and currently am working on one with him and he is very experience in JS. So i don't think he is going to call it bad.

Link to comment
Share on other sites

 

As long as you aren't saying JS is bad in general, you're fine.

 

Hell no, I love JS. The frontend of my forums system is going to be entirely ajax (like gmail kinda style, with an emphasis on scalability) I'm just saying it doesn't need to be used when it doesn't have to be. Laziness != Efficiency is my motto.

Link to comment
Share on other sites

 

As long as you aren't saying JS is bad in general, you're fine.

 

Hell no, I love JS. The frontend of my forums system is going to be entirely ajax (like gmail kinda style, with an emphasis on scalability) I'm just saying it doesn't need to be used when it doesn't have to be. Laziness != Efficiency is my motto.

 

 

 

Ahh Ajax, the next next step on my quest to design websites (well, it should tie into my learning of JS right, considering most people call it "Javascript on steriods.")...And I'm sorry for assuming it would be useful, but as I said, I know nothing about PHP, and little about JS (what JS I know I know through learning Java, since quite a few things are syntactically similar).

 

 

 

And I never said Errdoth said JS was bad, just that by the tone of his posts, it seemed like he was putting down JS. Am I the only one who thought so? :oops:

[hide=Funny Quotes]

So you sucker punched a kid in the back of the head? Good job.
What scares me is that you're like 10 years old.
-.- im not that freaking young
You were a couple years ago.
It's not racist if its true.
Hmm... I wonder how one goes about throwing someone out a window in a mystic fashion :-k

 

The mental image for that is freaking awesome.

[/hide]

- I dont need to "get a life." I'm a gamer - I have LOTS of lives!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.