Author
Topic: Magnet Link Library 3.0 LUA 5.1 (Read 16710 times)

first of all this script is originally written by St0ne db and i use it since a few years now.For the fact that it version 2.0 from this script dont work with the newest version from PtokaXi thought its time to start learning LUA myself and convert this amazing script.

And now here it is: Magnet Link Library 3.0

Its not only converted - i have also added and changed some things in this script (read more about it in the script).

For everybody who dont know this script:This is a Release & Request bot with alot of features- Add/Remove Categories- Add/Remove Releases- Add/Remove Requests- Add comments to releases- Vote for the releases- Add a description to the releases- Add Magnet links to the releases- Add Weblinks to the releases- Nuke releases- Ranking system ....

I have tested it alot (cause its the first time i converted a script) and couldnt find any error in it.If you find any error let me know. And also feedback is welcome.

best regardslUk3f1l3w4lK3R

Edit:I have noticed that i had attached the wrong version to this post.The one i had attached didnt send the RCMenu to registered users (only to op and higher).I have updated the attachment with the correct version.

I'm implementing this script for my hub (was trying freshstuff but this is superior) and it is revolutionizing how our entire hub works. It is amazing!

There's one major thing we're looking for though, and that's editing existing releases. (the release name, and also contents of the release info).

Currently we can only change something by deleting and re-adding, a cumbersome process.

Like jorgo suggested, is there a chance this might be possible? I am not sure how complicated adding an 'edit release' function would be, it seems pretty central to the script with a lot to do with the database and maintaining it etc...but maybe it's not that complicated ...

I will try to add this option but this can take some time cause i just started learning LUA.

Btw there is allready something like this, not exactly an edit option,but when using the wizard to add a release/requestyou can allways type:back - for going a page back

and there is the verification of the release/request information you wanna post.At this point of the wizard you get a preview of your post.If something is wrong just type back and edit the things you wanna edit.

First of all, this is an awesome request/release bot and it is much appreciated that you took the time to update it. A couple of things for the next release:

What this script is really missing is a way to "fill" requests. Right now I don't see any way of doing that so the requests just stay in the requests section until they expire, filled or not. What this script needs is a "FillReq" wizard.

The help should be dynamically served based on what privileges the user has. Also, it doesn't reflect any changes you might make to the commands at the top of the script.

Lastly, the right click menu doesn't take into account the fact that the user of the script may want to give users less power and make some more functions inaccessible to them. The RC menu is hard-coded much like the help in that if you change variables at the top, users will get RC commands they won't be able to use.

pR0Ps

EDIT: The tweaks here will work on an unmodified version of MLink Lib 3.0a. I have released my fully modified version with all these tweaks and more farther down.

VOTING FIX:I kept running into a bug while using the voting feature (it would crash when you had already voted on a release, then tried to vote again, while skipping the comment. I have traced the bug to the Wizard.AddVote method (in Wizard.lua). It tries to call the

Wizard.AddVote[5](skin) method (the finish screen) which doesn't exist. Also, if it DID call it, it wouldn't find the file AddVote5.txt (not included in any of the skins). To fix this I added the Wizard.AddVote[5](skin) method below:

[5] = function(skin)return doLoadFile("skin/"..skin.."/AddVote5.txt");end,Then went into every skin folder and renamed Vote5.txt to AddVote5.txt. You can delete the other Vote#.txt files, they aren't used anywhere in the script. Personally, I even changed the

VOTING BUG FIX:When you have already voted (so you cant again and it skips you to the comment step), at the comment step, all you have to do is type 'b' or 'back' to go back and edit your rating. This messes up the rating count because you have edited your rating, but also added 1 to the rating count. Using this fix, users will still be allowed to go back and input a rating, but it won't make any difference. Simply add the following code to the bottom of the

if Library[tonumber(temp.rel.cat)]["items"][tonumber(temp.rel.var)]["voted"][user.sNick] then temp.vote.rating = "Not Rated";endThis simply checks again if the user has already voted right before the they confirm the data and it gets sent to the LibTask.Vote() method and changes it without the possibility of the user modifying it.

DISCLAIMER: My version of MLink has been heavily edited and tweaked so if something doesn't work, thats why. I've tried to make these snippits compatible with the original, but I may have missed something.

I will post my complete script once I have finished adding the features I want to it. EDIT: Posted

All the tweaks I was doing were getting really hard to keep separate and post for an unmodified version of the script so I'm just going to post the entire thing here as a mod. It includes all the tweaks above, plus some more features. On the other hand, it also removes a lot of features because I made this for my personal hub and took out anything I didn't want/need. I present to you: Magnet Link Library 3.0a - pR0PsMod LUA 5.1

Quick Changelog:

Fixed: Voting bugRemoved: Skinning option and built in skin (only the 'simple' skin now)Removed: Option for custom help command (is now !help)Removed: Reporting memory usageRemoved: URLs from releasesRemoved: Seperate notification bot (all through main Library bot now)Removed: All quick commands that have wizard counterpartsChanged: The main skin was modified in placesChanged: New release notifications are now only one line (less obtrusive)Changed: Less obtrusive authorization errorsChanged: Permissions are now true/false, not 1/0 (easier if statement checking)Changed: The ChatArrival function now displays help and passes the command through to the hubsoft (you get both help texts)Changed: Countless minor tweaksAdded: Dynamic help systemAdded: Dynamic right click menuAdded: Option for multiple command triggers with a default for displaying within helpAdded: Mechanism for filling requests (with skin)Added: Optional integration of offline request filled notifications (use your own script)Added: Library method for adding points to a users' rank

I'm using the pR0Psmod version of this, and am the owner of my hub, even by profile.Loading the script from scratch with PtokaX 0.5.0.0 and trying to add a new category (or anything else for that matter), I kept getting access denied.

There are two concerns I have;For one, I had a look in the script and am not entirely sure what to put where when defining profiles by numbers.Second, trying to check what profile the script thinks I have, using !myrank, it crashes with this: