Problem with Equipment Script (RGSS2)

Hi, I'm using this old script by Vampyr which allows you to have multiple equipment slots (like capes, rings, amulets) and such. However, whenever I seem to use it, it always crashes when a player gets a piece of armour (of any kind). Yet, it doesn't crash when the player gets a weapon.


Here's the script: http://pastebin.com/kapP2Y7r


I get an error on Line 17.


In the instructions it says to put note in the equipment "Kind = X" with X being which equipment kind it is (so shield = 2).


It also states to NOT use that code for default armors. Yet I get crashes if I don't use the note, and crashes if I do use the note.


(Tested on multiple projects, same error)


Anyone can help find the problem? Thanks


If not, is there a script that does a similar thing (that works properly).


This is for a RPG VX Project.
you read the instructions wrong - the script says to use the note ONLY for the NEW kinds of equipment, not for the existing kinds. So any note Kind = X requires the X to be 5 or higher, you should never set Kind=2 for shields etc. Because the default armors are the Kind= 1 to Kind =4


If there is another error, then you probably configured the script wrong - please post the parts where you configured it (no need for the entire script).


Configuration in this case requires you to change the numbers inside that script after placing it in your project. Because by default it is configured to give you only weapon slots as additional slots.
Hi thanks for the quick reply, I tried the script without the note and I still get crashes at the same line. And I have not configured the script at all, would I have to configure it to make it work? If so, how would I have to configure it to make it work for my project? I just need to add the new armour slots (and make the old ones work).
yes, you need to configure that script - and you configure it by editing it.


And since it doesn't contain any information about the required edits (other than being written in such a way), you better point us to the website where it is described instead of to the direct download.
Haha I wish there was still support for VX or any of that guys scripts, I found it from some Spanish website where it was shared like 4 years ago without and explanation on how to use it. Here's the website I got it from: Link. But there really is nothing there to help configure the script.


Oh and I just tried the other scripts, a lot of them seem to be not working, I think they were uploaded wrong. I remember using a few of these scripts in a demo years ago and they were working.
It might help if you tell us what the error message actually says - the whole thing, script name, line and error.  Also a screenshot of your armor that's causing the problem (an actual screenshot - please don't copy/paste anything or worse, retype it).


The person who uploaded that script to that site needs to be hit over the head with something large and heavy for the way they've uploaded it.
Sure, so here's the error message:

Spoiler
zSmUKSG.png



This is line in the code:

Spoiler
qvKCWnZ.png



And this is the item:

Spoiler
G8XvFS5.png





So basically there's no crashes when I open the equipment without any items:

Spoiler
olVCbWG.png





Only crashes when I give the player any piece of armour (not weapon). Crashes as soon as I open equipment, so I can give the player the shield, but it will only give that error message when I open equipment.
The error message is saying there is no such method as read for the class String.  I thought it was strange when I first saw that line - don't think I've ever seen anyone use str.read to look for something in notes before.  I've just done a quick search online as well as in my Ruby programming books and I can't find a String read method in any of them.  Strange, because if that's the case, NOBODY would be able to use that script without changing it.  It's almost as if there's meant to be another script with an extra method defined.
AFAIK ruby only have read for File classes, which outputs strings.. Actually even other languages I used before doesn't have a read method for strings because normally you read from files directly...


He probably has a core script which defined a read method for the note class, basing from what it seem to do.. Looking at how he called it, it seems like he made a wrapper method that makes his searching for notetags and it's equivalent value/s easier. 


Try looking if he has indeed made a core script. And does the script have a thread in this forums or not? 
Hmmm, thanks for the clarification. I'll see what I can find in his other scripts.


There is a core script named "Vampyr Kernel" which activates his scripts, but it doesn't seem to have anything to do with a read method nor change anything to do with this script.


I tried removing the lines 12-25 (where the error is) and the equipment is now working again except the new kinds still don't work, only the first 5 slots work again.


I have a feeling this script was made for a version of his ABS (he's probably submitted more than 15 variations of it, and each time he made new scripts to be compatible). 


Can't find a thread in this forums. Only can find stuff on Portuguese VX forums.
lol - I get a script error so I'll try deleting random lines from the script.  Yeah, that'll work.


The lines are there for a reason.  You can't just go deleting stuff and expect it to work.  The new kinds don't work because you just delete the part of the script that reads the new kinds from the notes.


Look for a solution to the error you've got, rather than guessing and creating more errors.


Please show a link to the Vampyr Kernel script.  We're not going to go hunting for it.  I've spent quite a bit of time looking at this for you already and am just about ready to give up.  If you want help, you've got to make it easy for people (don't make them go looking for stuff when you've got the link right there).
Haha wasn't trying to make the script work by deleting the lines, but it shows that the main fault is within that line as the game didn't crash when the lines were removed, now all that's left is trying to make the rest of the script work. I already knew that the new kinds relied on that part, was just seeing if the script has any other errors other than that really.


I pasted the Kernel here as I can't find a proper place to link it


http://pastebin.com/y25SVecf


A lot of his other scripts start off with:

Vampyr_Kernel.register("Vampyr Bestiary",  1.1,  "11/30/2009")

or

if Vampyr_Kernel.enabled?("Vampyr SBABS")

But that just looks like to make some scripts enable like HUD to be enabled if the battle system script is there. (HUD is a seperate script).


I'll try looking more for the Equipment Plus script, maybe the version that guy uploaded was incomplete?
Doesn't look like it's incomplete, but maybe when he wrote (and tested) it, he had another script that allowed reading of notes.  I know before I started moving my game to MV, I created scripts that would read notes like MV does, and other scripts I planned to write would depend on those being present.



It'd be good if you could find where that script was originally shared (by the author - the link you provided I suspect was just the script being shared by someone else), and see if there are any comments from other users about the issue.


The solution is simply to rewrite that method in a way that will extract the data properly and return the correct value based on whether the note is present or not.  I suspect regular expressions will be needed.  I did a bit of testing earlier and didn't come up with an easy one-line replacement.  VX not having a console also makes things a bit more difficult.
Thanks for all the help so far man. All your tips have pointed me to the right direction.


And you were right, I went searching allover my files and I found one of his old battle systems that have the same read line. I put the Equipment Plus script and it worked!


(I sent this battle system to myself back in 2010 on my old email and luckily was still there 😛  - it took me forever to find!)


I'll paste the script here if you want to take a look at it. http://pastebin.com/fzxN0Xu8


I put the read method in the new battle system and it worked:

class Object
  
  def load(param)
    self.each_line { |i| return true if i =~ /#{param}/i }
    return false
  end
  
  def read(param, onfail=nil)    
    self.each_line { |i| return i.gsub("#{param} = ", "").chomp if i =~ /#{param} = /i }
    return onfail
  end
  
end



I put the load method as well in case for other scripts I want to use down the line.


But as of now, all kinds are working! 
Here's a pic of how it looks in game! I'm so glad it's working, now time to make it into visual equipment >_>


qEYORIG.png

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-equipment-script-rgss2.72260/