User talk:Dandwiki Helper

From D&D Wiki

Jump to: navigation, search

Hi-Risek 16:24, 17 June 2008 (MDT)

Bot Question[edit]

Is there any way to have this bot set up to automatically change all links to Dungeons and Dragons over to 3.5e Homebrew? Or if not, create a bot just to do that? Bots are really an area I have very little knowledge of. If someone can find a similar one on wikipedia or such I might be able to figure my way through altering it, but as far as making one - just don't have that knowledge. There are around 5,000 links to the old D&D page that need to be updated to 3.5e Homebrew, as seen here. Anyways, is this possible, or do I just have to do the mundane bits.   Hooper   talk    contribs    email   09:15, 18 October 2009 (MDT)

User:Dmilewski (User:Dmilewski/Wikibot) should help you. --Green Dragon 00:57, 19 October 2009 (MDT)
Thanks. I've tried for a good half hour to get Dmilewski's talk page to load but can't, and not sure what is happening there. So I'm MOIing him here.
Dmilewski, on this above linked page (User:Dmilewski/Wikibot) I've got just a note and a couple questions. The note is that on the second mention of "Endhaven Supplement" the word supplement is misspelled. Not sure if that is a big deal just letting you know. Secondly, as I read this code, I would need to change the bit that reads # $DirtyText =~ s/\(Endhaven\)/(Endhaven Supplement)/g; to read # $DirtyText =~ s/\(Dungeons and Dragons\)/(3.5e Homebrew)/g; . Earlier on in the script it describes opening up the page you need in order to begin, which in my case is Special:Whatlinkshere/Dungeons_and_Dragons. I'm not quite clear on the "hash" bits and all that, so could you step me through altering that code part and placing it at User:Hooper/Wikibot?   Hooper   talk    contribs    email   09:30, 19 October 2009 (MDT)
The usage is (perl) filename
The file is a text file full of wiki page names. That's how you control input. It reads down the list of pages, opening and operating on each page, one at a time. For example, a line could contain "SRD:Hit Points". The page name is exactly as you would refer to it with the double brackets. The HTTP: location is hard coded in the script.
From there, you just go down and alter DirtyText$ to fit your transformation criterias.
The "Endhaven" line is just an example.
So the order of work is:
  1. Get a listing of the pages that you wish to alter out of the wiki.
  2. Put the listing into a text file and clean it up, one page name per line.
  3. Put in your transformation.
  4. Put in your edit label, "Updating footing".
  5. Test your script by having it print.
  6. Test your script by having it write out to the Sandbox.
  7. Run your script.
I hope that helps it make a little more sense. It's perl, so it's not like it's a rational scripting language. --Dmilewski 19:43, 19 October 2009 (MDT)
Eh, I may just do it the hard way as to avoid really messing up any coding.   Hooper   talk    contribs    email   19:44, 19 October 2009 (MDT)
I started User:Green Dragon/wikiplbot however, although it runs though ("perl" in the terminal) the "Hello World" is not displayed. Do you know why? Also this stops me from seeing (e.g.) owner@diviron:~/Desktop$ perl Can't locate CMS/ in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at line 3. BEGIN failed--compilation aborted at line 3.. For reference I installed perl -MCPAN -e 'install DBI' and tried to install perl -MCPAN -e 'install DBD::Pg' (<- although this did not install correctly - is it needed?).
But do you know why the "Hello World" is not displayed (aka the script is not usable) when the CMS::MediaWiki package is hard-coded in?
Of course something as simple as
print "Hello, Wor--Dmilewski 19:43, 21 October 2009 (MDT)ld.......\n";
works fine. --Green Dragon 22:39, 19 October 2009 (MDT)
I have a feeling I need to read up on perl quite a bit. UPDATE: After reading over perl and trying to understand a basic intro to it, I have to admit that I'm way out of my league here. Not a programmer at all, so I'll just keep doing it the other way because I know I'll end up messing up the code and causing more harm than good.   Hooper   talk    contribs    email   06:18, 20 October 2009 (MDT)
I am not a developer either. What I was trying to do is manually add the CMS::MediaWiki package into the bot so I do not get the error message I was getting above. It runs through - it just does not work (print, etc). Does anyone know why this is the case? Of course perl does not run for me without adding #!/usr/bin/perl; although the chance that is making print not work is probably close to 0%. --Green Dragon 09:56, 20 October 2009 (MDT)
CMS:MediaWiki is an add-in for some version of perl. I had forgotten that you need MediaWiki to make the script work. I think that you need to use CPAN to add in a module. If you just drop the module into the path, perl doesn't know about it.
Perl is an amazing language. There is no better text crunching language that I know if. It's what I used to do the primary conversion of the SRD from HTML to Wiki. However, it's not quick and easy to pick up. On top of that, you are using regular expressions, which can be fairly brain-warping on their own. (Note: Regular expressions ROCK.)
If you are in doubt, definitely do things by hand. GreenDragon can tell you about one horrid script mistake where I crashed the wiki. --Dmilewski 19:43, 21 October 2009 (MDT)


I realize none of these scripts seem to be working right now, but when they are up and running again I have a suggestion. Currently the function of cleaning the sandbox operates every three hours, regardless of whether or not there's new material. I don't know how long the bot was running, but 8 edits / day = 56 edits / week = ~2900 edits per year, a vast majority of which don't actually do anything. Would it be possible to detect if there's anything new, and only clean it out if there's actually something there? JazzMan 21:33, 19 May 2010 (UTC)

Yes that would help to stop to many pointless edits forming in the recent edits section, however bot edits are auto hidden normally. So I'm just wondering, what good would this do? I don't mean this in a rude way, but it could be a lot of work to reprogram it like that, so if it doesn't help with anything, why change it?--Vrail 21:39, 19 May 2010 (UTC)
It can be done (counting the characters) — but what if the characters are the same as the standard? Maybe it could just be blanked huh... But first other things (like forms and so) in any case. --Green Dragon 21:44, 19 May 2010 (UTC)
No offense taken, I'm just OCD :) I mean it's not a priority or anything, but there's just no need to make that many edits, either. Bot edits are hidden but they still happen. I don't know technically how to do it, but it shouldn't be that hard. For example, the bot could search the page for the ----, and if there's any text after that it resets. If it can't find the ---- then it also resets. Now I don't have the slightest idea how to make that into computer-speak, but I know enough to know that it shouldn't be too difficult.
And again, not a priority. Let's get the scripts working before we worry if they are optimized ;-) JazzMan 01:25, 20 May 2010 (UTC)
Home of user-generated,
homebrew pages!