KAINE87'S PROFILE

Search

Filter

RMN Music Pack 2

Finally! The wait is over!
A big thank to all the partecipants and the judges

+++ DynRPG - The RM2k3 Plugin SDK +++

I found this plugin of pepsiotaku:
https://github.com/andrew-r-king/battle_end_switch_on
For the win/flee there is an option in battle processing command

2k3-4evr

2k3 is the way!

[DYNRPG] OpenGL Renderer & Video Options menu

Works fine here too!
Are you sure you are using one of the latest version of dynrpg?
0.32 is the sdk for the plugins not the dynrpg version!

[RM2K3] Problems with "Wait for Key Input" Command

Wait for the key pressed freeze the game in battle.
Here you can find some info.
https://wiki.easyrpg.org/development/technical-details/common-events-battle-2003

[RM2K3] DynRPG Compiling Error

Text plugin works in battle, if you use the patch named picsinbattle.
http://share.cherrytree.at/showfile-14985/picsinbattle.ips

For the source code I have an older version of it(not the last one).



#define AUTO_DLLMAIN
#include <DynRPG/DynRPG.h>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <cmath>

struct textObj
{
int x;
int y;
int color;
bool fixed;
std::string txt;
RPG::Image* img;
};

std::string parseText(std::string in);
typedef std::map<std::string, textObj> TextMap;

int picID;
TextMap drawList;

bool onDrawPicture(RPG::Picture* picture)
{
if(picture->id == picID)
{
TextMap::iterator itr = drawList.begin();
while(itr != drawList.end())
{
int x = itr->second.x;
int y = itr->second.y;
if(itr->second.fixed)
{
x -= RPG::map->getCameraX();
y -= RPG::map->getCameraY();
}
itr->second.img->alpha = 255 - picture->transparency/100.0 * 255;
RPG::screen->canvas->draw(x, y, itr->second.img);
//RPG::screen->canvas->drawStretched(x, y, itr->second.img->width*3, itr->second.img->height*3, itr->second.img);
itr++;
}
}
return true;
}

void onInitTitleScreen()
{
TextMap::iterator itr = drawList.begin();
while(itr != drawList.end())
{
TextMap::iterator tmp = itr;
RPG::Image::destroy(itr->second.img);
itr++;
drawList.erase(tmp);
}
}

bool onStartup(char *pluginName)
{
std::map<std::string, std::string> configuration = RPG::loadConfiguration(pluginName);
std::map<std::string, std::string>::iterator itr = configuration.find("PictureID");
if(itr != configuration.end())
{
picID = atoi(itr->second.c_str());
}
else
picID = 1;
return true;
}

void onSaveGame(int id, void __cdecl(*savePluginData)(char*data,int length))
{
std::string s;
TextMap::iterator itr = drawList.begin();
while(itr != drawList.end())
{
std::stringstream ss;
ss << itr->second.x << "," << itr->second.y << ",";
ss << itr->second.txt << "," << itr->second.color << ",";
ss << itr->second.fixed << "," << itr->first << ",";
s += ss.str();
itr++;
}
savePluginData((char *)s.c_str(), s.size());
}

void onLoadGame(int id, char* data, int length)
{
char* buffer;
if(data == NULL) return;
buffer = strtok(data, ",");
while(buffer != NULL)
{
textObj obj;
obj.x = atoi(buffer);
buffer = strtok(NULL, ",");
obj.y = atoi(buffer);
buffer = strtok(NULL, ",");
obj.txt = buffer;
buffer = strtok(NULL, ",");
obj.color = atoi(buffer);
buffer = strtok(NULL, ",");
obj.fixed = atoi(buffer);
buffer = strtok(NULL, ",");
obj.img = RPG::Image::create(obj.txt.size()*6 + 8, 16);
obj.img->setSystemPalette();
obj.img->useMaskColor = true;
obj.img->drawText(0, 0, obj.txt, obj.color);
drawList.insert(std::make_pair<std::string, textObj >(buffer, obj));
buffer = strtok(NULL, ",");
}
}

std::string formatText(std::string s)
{
int size = 2;
while(size < s.size() && s!=']')size++;
size -= 2;
switch (s)
{
case 'x':
{
TextMap::iterator itr = drawList.find(s.substr(2, size));
if(itr != drawList.end())
return itr->second.txt;
return s;
}
case 'n':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
return RPG::actors->getName();
}
case 'N':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
return RPG::actors->getDegree();
}
case 'v':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
std::stringstream ss;
ss << RPG::variables;
return ss.str();
}
case 'i':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
return RPG::getItemName(n);
}
case 'I':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
return RPG::getItemDescription(n);
}
case 't':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
return RPG::getSkillName(n);
}
case 'T':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
return RPG::getSkillDescription(n);
}
case 'a':
{
int n = atoi(parseText(s.substr(2, size)).c_str());
return RPG::getConditionName(n);
}
default:
return s;
}
}

std::string parseText(std::string in)
{
std::string out;
for(unsigned int i = 0; i < in.size(); i++)
{
if(in == '\\')
{
out += formatText(in.substr(i + 1, in.size()));
while(i < in.size() && in!=']')i++;
while(i + 1 < in.size() && in==']')i++;
}
else
out += in;
}
return out;
}

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 s = parsedData->command;

if(!s.compare("write_text"))
{
TextMap::iterator itr = drawList.find(parsedData->parameters.text);
if(itr == drawList.end())
{
textObj obj;
obj.x = parsedData->parameters.number;
obj.y = parsedData->parameters.number;
obj.color = (parsedData->parameters.type == RPG::PARAM_NUMBER && parsedData->parametersCount >= 6)?parsedData->parameters.number:0;
if(parsedData->parameters.type == RPG::PARAM_STRING)
{
std::string tmp = parsedData->parameters.text;
obj.fixed = (!tmp.compare("fixed"))?true:false;
}
else
obj.fixed = false;
if(parsedData->parameters.type == RPG::PARAM_NUMBER)
{
std::stringstream ss;
ss << parsedData->parameters.number;
obj.txt = ss.str();
}
else
obj.txt = parseText(parsedData->parameters.text);
obj.img = RPG::Image::create(obj.txt.size()*6 + 8, 16);
obj.img->setSystemPalette();
obj.img->useMaskColor = true;
obj.img->drawText(0, 0, obj.txt, obj.color);
drawList.insert(std::make_pair<std::string, textObj >(parseText(parsedData->parameters.text), obj));
}
return false;
}

if(!s.compare("append_line"))
{
TextMap::iterator itr = drawList.find(parseText(parsedData->parameters.text));
if(itr != drawList.end())
{
if(parsedData->parameters.type == RPG::PARAM_NUMBER)
{
std::stringstream ss;
ss << parsedData->parameters.number;
itr->second.txt = ss.str();
}
else
itr->second.txt = parseText(parsedData->parameters.text);
int width = itr->second.txt.size();
if(width < itr->second.img->width)width = itr->second.img->width;
RPG::Image* tmp = RPG::Image::create(width*6 + 8, 16 + itr->second.img->height);
tmp->drawText(0, itr->second.img->height, itr->second.txt, itr->second.color);
tmp->draw(0, 0, itr->second.img);
itr->second.img->init(width*6 + 8, 16 + itr->second.img->height);
memcpy(itr->second.img->pixels, tmp->pixels, tmp->width * tmp->height);
RPG::Image::destroy(tmp);
}
return false;
}

if(!s.compare("append_text"))
{
TextMap::iterator itr = drawList.find(parseText(parsedData->parameters.text));
if(itr != drawList.end())
{
if(parsedData->parameters.type == RPG::PARAM_NUMBER)
{
std::stringstream ss;
ss << parsedData->parameters.number;
itr->second.txt += ss.str();
}
else
itr->second.txt += parseText(parsedData->parameters.text);
itr->second.img->free();
itr->second.img->init(itr->second.txt.size()*6 + 8, 16);
itr->second.img->drawText(0, 0, itr->second.txt, itr->second.color);
}
return false;
}

if(!s.compare("change_text"))
{
TextMap::iterator itr = drawList.find(parseText(parsedData->parameters.text));
if(itr != drawList.end())
{
if(parsedData->parameters.type == RPG::PARAM_NUMBER)
{
std::stringstream ss;
ss << parsedData->parameters.number;
itr->second.txt = ss.str();
}
else
itr->second.txt = parseText(parsedData->parameters.text);
itr->second.color = (parsedData->parameters.type == RPG::PARAM_NUMBER)?parsedData->parameters.number:0;
itr->second.img->free();
itr->second.img->init(itr->second.txt.size()*6 + 8, 16);
itr->second.img->drawText(0, 0, itr->second.txt, itr->second.color);
}
return false;
}

if(!s.compare("change_position"))
{
TextMap::iterator itr = drawList.find(parseText(parsedData->parameters.text));
if(itr != drawList.end())
{
itr->second.x = parsedData->parameters.number;
itr->second.y = parsedData->parameters.number;
}
return false;
}

if(!s.compare("remove_text"))
{
TextMap::iterator itr = drawList.find(parseText(parsedData->parameters.text));
if(itr != drawList.end())
{
RPG::Image::destroy(itr->second.img);
drawList.erase(itr);
}
return false;
}

if(!s.compare("remove_all"))
{
TextMap::iterator itr = drawList.begin();
while(itr != drawList.end())
{
TextMap::iterator tmp = itr++;
RPG::Image::destroy(tmp->second.img);
drawList.erase(tmp);
}
return false;
}

if(!s.compare("debug"))
{
TextMap::iterator itr = drawList.begin();
while(itr != drawList.end())
{
MessageBox(NULL, itr->first.c_str(), "textPlugin", MB_ICONINFORMATION);
itr++;
}
return false;
}

return true;
}


[RM2K3] Dyntext error

do you use the text plugin elsewhere?
There may be some value saved in memory.

[RM2K3] Dyntext error

Change_text don't use coordinates and your write_text is totally wrong for what I see
This should work:
@Write_text "APShow",38,125, "\v(261)",,0<-(color of the text)

@change_text "APShow","\v(261)",0<-(color of the text)

change the round brackets with square brackets, in "\v(261)"
I don't know why but the forum deletes what is inside if I write them

[RM2K3] "Loading plugin "condition_icons.dll" failed! (1114)"

author=AshleyWasHere
author=kaine87
Try removing conditionicons.dll from the folder named Dynplugins.
Lollo forgot to remove that plugin, from the new version of theia(that uses DynbattleDisplay.dll to show the conditions icons)
Thanks for the advice. I'm now getting a "Not Implemented" Error

New game or a load file?
If it is the second case, try to restart a new game.
The save probably contains information from the old plugin and not finding it gives you an error

[RM2K3] "Loading plugin "condition_icons.dll" failed! (1114)"

Try removing conditionicons.dll from the folder named Dynplugins.
Lollo forgot to remove that plugin, from the new version of theia(that uses DynbattleDisplay.dll to show the conditions icons)