| Welcome, Guest |
You have to register before you can post on our site.
|
| Online Users |
There are currently 330 online users. » 2 Member(s) | 326 Guest(s) Bing, Google, glxs, top1gamebaicom1
|
| Latest Threads |
Let's get this thread to ...
Forum: Village Games
Last Post: Camer the Dragon
32 minutes ago
» Replies: 38,982
» Views: 12,269,249
|
Mia’s Surprise
Forum: Survivor
Last Post: bls1999
2 hours ago
» Replies: 5
» Views: 115
|
Last post wins!
Forum: Village Games
Last Post: Resarekt
3 hours ago
» Replies: 2,621
» Views: 2,448,352
|
Challenge 10: Race to the...
Forum: Survivor
Last Post: Sushie
8 hours ago
» Replies: 18
» Views: 663
|
What are you listening to...
Forum: Multimedia Masterpieces
Last Post: JEEJAYEM
8 hours ago
» Replies: 388
» Views: 470,821
|
2026 FIFA World Cup
Forum: Game Day
Last Post: Master Raiden
9 hours ago
» Replies: 68
» Views: 2,136
|
I married my pr2 boyfrien...
Forum: Blogs
Last Post: Adulock77
22nd June 2026, 7:19 PM
» Replies: 23
» Views: 2,070
|
Survivor: Jiggmin’s Reviv...
Forum: Survivor
Last Post: Resarekt
22nd June 2026, 7:11 PM
» Replies: 1,334
» Views: 114,166
|
Thread has a "stuck post"
Forum: Bugs and Suggestions
Last Post: Mia
21st June 2026, 7:11 PM
» Replies: 15
» Views: 649
|
[Finished] PR2 Live Strea...
Forum: Announcements
Last Post: Resarekt
21st June 2026, 6:41 AM
» Replies: 4
» Views: 260
|
|
|
| Snowy JV |
|
Posted by: bls1999 - 9th December 2018, 8:44 PM - Forum: Announcements
- Replies (4)
|
 |
In honor of it being winter in most of the world (looking at you, @Nemo Nation), I've changed the normal bubbles to something a little more appropriate. Stay warm!
|
|
|
| PHP Find/Replace Script |
|
Posted by: bls1999 - 8th December 2018, 5:22 AM - Forum: Coding and Development
- Replies (2)
|
 |
When sifting through old code trying to find different names of things, I've found it extremely useful and time-saving to run a PHP script from the command line that searches through all the files in a directory on my computer for a search term. On this particular project, I have it set to sift through ActionScript files only, but you can set it to anything. Here it is, if anyone's interested:
PHP Code: <?php
$base_path = __DIR__ . "/fla";
if (!isset($argv[2])) { $argv[2] = false; }
$files = getDirContents($base_path); search_files($files); die();
function getDirContents($dir, &$results = array()){ $files = scandir($dir);
foreach($files as $key => $value){ $path = realpath($dir.DIRECTORY_SEPARATOR.$value); if(!is_dir($path)) { $results[] = $path; } else if($value != "." && $value != "..") { getDirContents($path, $results); $results[] = $path; } }
return $results; }
function search_files($files) { global $argv;
$continue = false; $filesChanged = 0; foreach ($files as $file) { $file_path = $file; if (substr($file, -3, 3) == ".as") { $find = $argv[1]; $strict = $argv[2] == 'true' ? true : false; $file = file_get_contents($file_path); if ($strict === false && strpos($file, $find) !== false && !isset($argv[3])) { echo "$file_path\n"; } elseif ($strict === true && preg_match("/\b$find\b/", $file) && !isset($argv[3])) { echo "$file_path\n"; } elseif (isset($argv[3])) { if ($continue === false) { echo "\nReplace \"$find\" with \"$argv[3]\"?\nWARNING: THIS CANNOT BE UNDONE.\n\nContinue? (yes/no): "; $reply = trim(strtolower(fgets(fopen("php://stdin","r")))); if ($reply == 'true' || $reply == 't' || $reply == 'yes' || $reply == 'y') { $continue = true; echo "\n"; } else { break; } } if ($strict === false && strpos($file, $find) !== false) { file_put_contents($file_path, str_replace($find, $argv[3], $file)); echo "$file_path\n"; $filesChanged++; } elseif ($strict === true && preg_match("/\b$find\b/", $file)) { file_put_contents($file_path, preg_replace("/\b$find\b/", $argv[3], $file)); echo "$file_path\n"; $filesChanged++; } else { continue; } } } } $continue = false; if ($filesChanged > 0) { echo "\nTotal files changed: $filesChanged\n\n"; } else { if (!isset($argv[3])) { echo "\n"; } else { echo "\nNo files to be changed.\n\n"; } } }
The arguments are:
[0] = File
[1] = Find
[2] = Strict? (yes/true uses preg_match to match exact words, no/false uses strpos for a character match)
[3] = Replace
A sample run on the command line for me would be:
Code: php /Users/ben/Projects/SuperSecretThings/search.php "Example" true
That would give me a strict, case-sensitive result for the complete word "Example" as opposed to also getting a result for "ExampleData".
Anyway, yep. I hope y'all learned something and/or have a use for the code in your own projects.
|
|
|
| PR2 Client Bug Reporting Thread |
|
Posted by: bls1999 - 6th December 2018, 5:34 AM - Forum: Bugs and Suggestions
- Replies (28)
|
 |
Have you been plagued by a client bug since the dawn of time? Well, now's your chance to get it fixed!
Use this thread to post about miscellaneous PR2 client bugs. While I'm rehabilitating the code, I'll try to patch as many as I can.
I've already patched quite a few, including:
- Kong badges
- Prize popup flavor text
- Chat scrollbar/arrows being wonky
- Game music resetting if you close the menu without choosing a new song
- Art being cleared when loading a level with draw BGs off
- Sir feet outline in truly invisible/bubble feet
- "Phantom" levels appearing below the clickable area and messing with the placement of the play/cancel menu you get when entering a slot
Looking forward to squashing some years-old bugs!
|
|
|
|