+++ DYNRPG - THE RM2K3 PLUGIN SDK +++

Posts

Thank you ! I'm not sure to get everything, but overriding the Show Picture command seems to be the best thing to do.

That's were I am :
author=me
int heroId = (int)parsedData->parameters[0].number;
int xDestination = (int)parsedData->parameters[1].number;
int yDestination = (int)parsedData->parameters[2].number;


if(RPG::dbActors[heroId] != NULL)
{
// Get the filename of the used faceset
std::string facesetFile = RPG::dbActors[heroId]->facesetFilename;

// Get which of the 4x4 facesets is used
int faceUsed = RPG::dbActors[heroId]->facesetId;

int xFace = (faceUsed%4)*48;
int yface = floor(faceUsed/4)*48;

RPG::Image *imgPtr = RPG::Image::create();
if (imgPtr != NULL) {
imgPtr->useMaskColor = true;
imgPtr->loadFromFile(facesetFile , false);

RPG::pictures[nextScriptLine->parameters(0)]->image->clear();
RPG::pictures[nextScriptLine->parameters(0)]->image->draw(0, 0, imgPtr, xFace, yface, 48, 48, false);
RPG::pictures[nextScriptLine->parameters(0)]->image->applyPalette();

RPG::Image::destroy(imgPtr);
}
}

But I have "error: no match for call to '(RPG::DArray<int>) (int)'" for the 3 RPG::pictures lines.
Hmmm, try:
RPG::pictures[nextScriptLine->parameters(1)]

It might be base 1.
Same error.

Actually, it's a compilation error, so this number shouldn't be the problem at this point.
OH! I'm an idiot. It's:
RPG::pictures[nextScriptLine->parameter(0)]

No "s" at the end. "parameters" is the DArray:
RPG::pictures[nextScriptLine->parameters->items[0]]

while "parameter" is the function (parameter(0)). Both do the same thing.

I don't think you need xDestination or yDestination btw, since you can just use the move picture command.
Ah, yes, amazing.

However, shit !!

author=BuildMessages
37|undefined reference to `RPG::DStringPtr::operator std::string()'|
45|undefined reference to `RPG::Image::create()'|
48|undefined reference to `RPG::Image::loadFromFile(std::string, bool, bool)'|
50|undefined reference to `RPG::EventScriptLine::parameter(int)'|
50|undefined reference to `RPG::Image::clear()'|
51|undefined reference to `RPG::EventScriptLine::parameter(int)'|
51|undefined reference to `RPG::Image::draw(int, int, RPG::Image*, int, int, int, int, int)'|
52|undefined reference to `RPG::EventScriptLine::parameter(int)'|
52|undefined reference to `RPG::Image::draw(int, int, RPG::Image*, int, int, int, int, int)'|
53|undefined reference to `RPG::EventScriptLine::parameter(int)'|
53|undefined reference to `RPG::Image::applyPalette()'|
54|undefined reference to `RPG::EventScriptLine::parameter(int)'|
54|undefined reference to `RPG::Image::applyPalette()'|
56|undefined reference to `RPG::Image::destroy(RPG::Image*&)'|

My skills in Code::Blocks are just lame. xD
It looks like you're either forgetting this at the top of your file:
#include <DynRPG/DynRPG.h>

or the actual linkage. Go to Project > Build Options > Linker Settings and add "DynRPG" if you haven't already
(Thank you for your support!)

I've not forgotten this at the top of the file... I've just added the linkage as well (I hope it's not doing harm since it's the same thing as the top of the file).

Anyway, the errors are still there. I'm googling this, there must be a library missing or something like that.
Ah, my absent-mindedness strikes again! I think I forgot to include the library file for the DynRPG 0.30 release, so first download 0.20 here: http://share.cherrytree.at/showfile-12494/dynrpg.rar and put the DynRPG folder in your include directory, and the libDynRPG.a file in your lib folder. Then drop the 0.30 files into the DynRPG folder and overwrite the files.
Haha, okay...

Well, it says "undefined reference to 'RPG::DStringPtr::DStringPtr(RPG::DStringPtr&)'"

Showing this from Variables.h :

DStringPtr RPG::Variables::name(int index) {
RPG::NamedCatalogPtr<RPG::Variable *> &n = (**reinterpret_cast<RPG::NamedCatalogPtr<RPG::Variable *> **>(0x4CDFC4));
return n->name;
}

Is there anyone than can create the dll for me ? :p

#define AUTO_DLLMAIN
#include <DynRPG/DynRPG.h>
#include <cmath>

//==================================================================================
bool onComment(
const char *text,
const RPG::ParsedCommentData *parsedData,
RPG::EventScriptLine *nextScriptLine,
RPG::EventScriptData *scriptData,
int eventId,
int pageId,
int lineId,
int *nextLineId)
//==================================================================================
{
if (
!strcmp(parsedData->command, "drawFaceFromId")
)
{
if(
(parsedData->parametersCount == 3) &&
(parsedData->parameters[0].type == RPG::PARAM_NUMBER) &&
(parsedData->parameters[1].type == RPG::PARAM_NUMBER) &&
(parsedData->parameters[2].type == RPG::PARAM_NUMBER)
)
{
int heroId = (int)parsedData->parameters[0].number;
//int xDestination = (int)parsedData->parameters[1].number;
//int yDestination = (int)parsedData->parameters[2].number;


if(RPG::dbActors[heroId] != NULL)
{
// Get the filename of the used faceset
std::string facesetFile = RPG::dbActors[heroId]->facesetFilename;

// Get which of the 4x4 facesets is used
int faceUsed = RPG::dbActors[heroId]->facesetId;

int xFace = (faceUsed%4)*48;
int yface = floor(faceUsed/4)*48;

RPG::Image *imgPtr = RPG::Image::create();
if (imgPtr != NULL) {
imgPtr->useMaskColor = true;
imgPtr->loadFromFile(facesetFile , false);

RPG::pictures[nextScriptLine->parameter(0)]->image->clear();
RPG::pictures[nextScriptLine->parameter(0)]->image->draw(0, 0, imgPtr, xFace, yface, 48, 48, false);
RPG::pictures[nextScriptLine->parameter(0)]->image2->draw(0, 0, imgPtr, xFace, yface, 48, 48, false);
RPG::pictures[nextScriptLine->parameter(0)]->image->applyPalette();
RPG::pictures[nextScriptLine->parameter(0)]->image2->applyPalette();

RPG::Image::destroy(imgPtr);
}
}
}
}
else if (
!strcmp(parsedData->command, "rmFace")
)
{
// rien for now
}
return true;
}
//==================================================================================
Hmmm... the class files worked for me. You shouldn't have that Variables.h error. Try getting rid of "#define AUTO_DLLMAIN" first of all. You don't need that.

Also, try deleting all the stuff in your DynRPG src folder completely, and then just extract the 0.30 files again. I'm wondering if you had an older DynRPG.h file in there or something.
Ok, now I have a new error :
undefined reference to `__gxx_personality_sj0'
undefined reference to `_Unwind_SjLj_Register'


It seems that it's coming from my compiler. (The exception handler SJLJ.)

I've tried other compilers but it's not working. Is your compiler old ?

Hi,
the newer series of MinGW released GCC does not use sjlj for C++ anymore.


This may be related to the Boost Library, do you use it ? => http://forums.xilinx.com/t5/Embedded-Development-Tools/Undefined-references-to-exception-symbols-mb-g/td-p/281766
Ugh, that's such a pain. I believe the version I have is 4.8.1. It's this:

codeblocks-13.12mingw-setup-TDM-GCC-481.exe

If you dont' already have that, you may need to backup your current project(s), uninstall the current one, and then install that one.

I've seen Boost mentioned a bunch of times on Stack Overflow, but I have not tried it or found a need for it yet. I mainly stick to WinAPI stuff if I can because it's usually the fastest. I try not to add any new libraries unless I absolutely have to. For example, XInput required an XInput.h file, and GameJolt required like 15-20 library files (for interfacing with their website) along with curl (required by the GJ one, for internet connection stuff).
Oh, thx, I will try that.

Someone reminded me that Cherry warned about it on the DynRPG website :
Important Information for Plugin Developers: Recent problems showed that DynRPG is not compatible with the latest GCC compiler version yet. Please only use version 4.6.1 or below!
Cherry changed the problematic things in DynRPG v0.20. Your are using DynRPG v0.30 with the v0.20 library, so its fine.
It seems that there is still a problem with recent compilators as I've installed different types of them like 20 times yesterday...

I've tried to do it with Eclipse instead of Code::Blocks, and compilator finds these errors in libDynRPG.a :
stray '\254'
stray '\30'
stray '\306'
stray '`'

Maybe I've found a solution on stackoverflow => http://stackoverflow.com/questions/2340930/stray-342-in-c-program
I think you are on a wrong path.

I made a code::blocks project for you. On my computer, it compiles.
http://share.cherrytree.at/showfile-19681/alexre.zip
Okay, so I've edited my file_control plugin below. So pretty good start with making an external file system.

http://rpgmaker.net/media/content/users/3388/locker/FileControl.zip

Only, I've got some stuff I wanna do, but dunno how. Okay, here's what it looks like. Dynstore.txt was originally part of KazString, but I split the old file and new one, since file_control was better suited for just working with files.


//created by bulmabriefs144


#include <DynRPG/DynRPG.h>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

std::map<std::string, std::string> configuration;




bool onStartup(char *pluginName) {
// We load the configuration from the DynRPG.ini file here
configuration = RPG::loadConfiguration(pluginName);
return true; // Don't forget to return true so that the start of the game will continue!
}

bool onComment( const char* text,
const RPG::ParsedCommentData* parsedData,
RPG::EventScriptLine* nextScriptLine,
RPG::EventScriptData* scriptData,
int eventId,
int pageId,
int lineId,
int* nextLineId )
{
std::string cmd = parsedData->command;
std::string filecode;
string FileName;

if(!cmd.compare("file_string")) //new code
{
ofstream myfile;
myfile.open ("dynstore.txt");
myfile << parsedData->parameters[0].text;
myfile.close();
return false;
}
if(!cmd.compare("store_file")) //new code
{
ofstream myfile;
myfile.open ("dynstore.txt");
myfile << RPG::actors[parsedData->parameters[0].number]->name;
myfile.close();
return false;
}
if(!cmd.compare("load_file")) //new code
{
ifstream myfile;
myfile.open ("dynstore.txt");
getline (myfile, filecode);
RPG::actors[parsedData->parameters[0].number]->name = filecode;
myfile.close();
return false;
}

//These first three allow only storage using dynstore.

if(!cmd.compare("make_file")) //custom file name, plus storing text
{
FileName = parsedData->parameters[0].text;
fstream myfile;
myfile.open (FileName.c_str());
myfile << parsedData->parameters[1].text;
myfile.close();
return false;
}

if(!cmd.compare("create_file")) //custom file name, plus storing text
{
FileName = parsedData->parameters[0].text;
fstream myfile;
myfile.open (FileName.c_str());
myfile << RPG::actors[parsedData->parameters[1].number]->name << "\n";
myfile.close();
return false;
}

if(!cmd.compare("read_file")) //sets data info to name for easy read
{
FileName = parsedData->parameters[0].text;
fstream myfile;
myfile.open (FileName.c_str());
getline (myfile, filecode);
RPG::actors[parsedData->parameters[1].number]->name = filecode;
myfile.close();
return false;
}
if(!cmd.compare("clear_file")) //sets data info to name for easy read
{
FileName = parsedData->parameters[0].text;
ofstream myfile;
myfile.open (FileName.c_str());
myfile.clear();
return false;
}

//End of cmd
return true;
}

I want the dynstore to be an appendable file, and I want it to newline after each Right now, it just overwrites. Is it just myfile.open ("dynstore.txt", ios::app)? Or is there some process that I'm also missing?

Second, I want a comment that is called scan file. It should have the following format

@scan_file filename (the same as create_file and make_file, it makes a custom file), string, switch number

I want it to look in each line of the file and basically, let's say the file has:

Apples
Oranges
Coconuts
Kiwis
Almonds
Pears
Walnuts
Salmon

@scan_file fruitsandnuts.txt, Salmon, 234

(Pfffft, "one of these things is not like the others...")

I can't remember if it needs to be quoted or not, btw. It should "see" the string in the file, and if the file has that string, turn switches on when stuff is in the file. CPlusPlus.com has some stuff about reading lines from strings, but I'm not sure if it works with files.

And yes, I probably have some unnecessary header files included.
You can use multiple of those Flags (Link) at the same time, like "std::ios::out | std::ios::nocreate|std::ios::app" which opens the file in append mode, but fails, if the file does not already exist. Try it with ios::out and ios::app.
Thanks! I did not know about nocreate (I'm gonna use that for the read ones, and app for the write ones). I'll try it when I update. Does "\n" work for files? As I say, I want a second line for ease of reading. Nevermind, I'll test it out.

Anyone know about the scan one (the reading line by line to make sure a string exists in the file)? I hope to make this fairly soon.

Uh oh.

Error: nocreate is not a member of std::ios

I'll try the program without it.

Okay, so far this basically works at the input end.


//created by bulmabriefs144


#include <DynRPG/DynRPG.h>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

std::map<std::string, std::string> configuration;




bool onStartup(char *pluginName) {
// We load the configuration from the DynRPG.ini file here
configuration = RPG::loadConfiguration(pluginName);
return true; // Don't forget to return true so that the start of the game will continue!
}

bool onComment( const char* text,
const RPG::ParsedCommentData* parsedData,
RPG::EventScriptLine* nextScriptLine,
RPG::EventScriptData* scriptData,
int eventId,
int pageId,
int lineId,
int* nextLineId )
{
std::string cmd = parsedData->command;
std::string filecode;
string FileName;

if(!cmd.compare("file_string")) //new code
{
ofstream myfile;
myfile.open ("dynstore.txt");
myfile << parsedData->parameters[0].text << "\n";
myfile.close();
return false;
}
if(!cmd.compare("store_file")) //new code
{
ofstream myfile;
myfile.open ("dynstore.txt", ios::app);
myfile << RPG::actors[parsedData->parameters[0].number]->name << "\n";
myfile.close();
return false;
}
if(!cmd.compare("load_file")) //new code
{
ifstream myfile;
myfile.open ("dynstore.txt", ios::app);
getline (myfile, filecode);
RPG::actors[parsedData->parameters[0].number]->name = filecode;
myfile.close();
return false;
}

//These first three allow only storage using dynstore.

if(!cmd.compare("make_file")) //custom file name, plus storing text
{
FileName = parsedData->parameters[0].text;
ofstream myfile;
myfile.open (FileName.c_str(), ios::app);
myfile << parsedData->parameters[1].text << "\n";
myfile.close();
return false;
}

if(!cmd.compare("create_file")) //custom file name, plus storing text
{
FileName = parsedData->parameters[0].text;
ofstream myfile;
myfile.open (FileName.c_str(), ios::app);
myfile << RPG::actors[parsedData->parameters[1].number]->name << "\n";
myfile.close();
return false;
}

if(!cmd.compare("read_file")) //sets data info to name for easy read
{
FileName = parsedData->parameters[0].text;
ifstream myfile;
myfile.open (FileName.c_str());
getline (myfile, filecode);
RPG::actors[parsedData->parameters[1].number]->name = filecode;
myfile.close();
return false;
}
if(!cmd.compare("clear_file")) //sets data info to name for easy read
{
FileName = parsedData->parameters[0].text;
ofstream myfile;
myfile.open (FileName.c_str());
myfile.clear();
return false;
}

//End of cmd
return true;
}

It appends, makes a newline, and stores the thing.

So if I have

@make_file "example.txt", "line1", end
@make_file "example.txt", "line2", end

It shows up as

line1
line2

This is pretty which I intended. Now I'm trying to scan line by line.

When I read the file, it just reads the first line. Which is fine for a basic file, but for the @scan_file I need it to do some sort of "while input is not equal to the string put into the comment, check next line". If the thing matches, I'm going to either save that line into filecode, or just turn on the thing.

Does anyone actually know how to scan line by line?

Closest thing I found was from another website.

01	#include <iostream>
02 #include <string>
03 #include <fstream>
04 void searchFile(std::string file);
05
06 int main()
07 {
08 std::string userInput;
09 std::cout<<"File: ";
10 std::getline(std::cin,userInput);
11 searchFile(userInput);
12 std::cin.get();
13 }
14
15 void searchFile(std::string file)
16 {
17 std::ifstream buffer;
18 buffer.open(file.c_str());
19 for(std::string temp;!buffer.eof();std::getline(buffer,temp))
20 {
21 if(temp.find("KALE")!=std::string::npos)
22 std::cout<<temp<<std::endl;
23 else if(temp.find("ARTISANAL")!=std::string::npos)
24 std::cout<<temp<<std::endl;
25 else if(temp.find("FIXIE")!=std::string::npos)
26 std::cout<<temp<<std::endl;
27 else if(temp.find("KEROUAC")!=std::string::npos)
28 std::cout<<temp<<std::endl;
29 else if(temp.find("JARMUSCH")!=std::string::npos)
30 std::cout<<temp<<std::endl;
31 else if(temp.find("NERDCORE")!=std::string::npos)
32 std::cout<<temp<<std::endl;
33 else if(temp.find("PBR")!=std::string::npos)
34 std::cout<<temp<<std::endl;
35 else if(temp.find("TATTOO")!=std::string::npos)
36 std::cout<<temp<<std::endl;
37 else if(temp.find("SCARF")!=std::string::npos)
38 std::cout<<temp<<std::endl;
39 else if(temp.find("INDIE")!=std::string::npos)
40 std::cout<<temp<<std::endl;
41 else if(temp.find("TURNTABLE")!=std::string::npos)
42 std::cout<<temp<<std::endl;
43 }
44 }

I'm gonna wanna try to translate the code from function to the comment system, and translate the temp.find specifics to the param entered. I'll try this in a day or so, and let you know if I need help. Probably so... ^_^;;
author=bugmenot
Here's one with a better "Miss!" detection:

download RPS[+]

"Miss!" won't be displayed if a Skill does not try to change any parameters of its target. "Miss!" will be displayed if a change of Conditions or Attribute resistances was tried and failed.


author=Shoobinator
SkillAccuracyFix=49C69A,04000F83,49C69B,%2
Only Skill's success rate will be considered if Skill_ID >= 2

Or use a Skill_ID range in which evasion calculation is allowed:
[QuickPatches]
SkillAccuracyFix=49C698,E940A8FAFF,446EDD,817B04000000007C0D817B04000000000F8EAF570500E974580500
SkillAccFixRange=446EE0,#1,446EE9,#2
If the desired Skill_IDs are higher than %127 (there just wasn't enough room to fit 32bit values into the earlier versions... something about wasting space)


Would it be possible to add ONE more thing to the RPS+ patch? I need an attribute tag (or some other way) that allows skills to ignore all Silence effects (i.e. skill is unallowed if ATK or INT influence is high enough). This was the one thing that I did not consider when trying to make an enemy skill that worked like a "true regular attack" (you had helped me fix damage multipliers for rows and evasion issues already). It would not make sense for standard enemy attacks to be silenced.

Alternatively, could a solution work for this silence issue by using a method similar to the SkillAccuracyFix quick patch?

Thank you once again for all the help!