EDIT: I fixed it. the code works.... I never changed the event in rpg maker mz. so I was using the plugin command technically from when it was wrong.
Hello, maybe someone can help me, I'm having trouble with writing a plugin. I'm trying to make a quest journal, I know that there a few plugins already, however, I want to get experience with programming as I eventually want to be a software developer. My code seems to mostly work for now, however when i try to use plugin commands in event editor I keep getting an error. with console.log I can see the args being passed in, but when I look at the quest in console after that, it says undefined for all my parameters. I tried using an ai to help with debugging and just helping get my start(I mostly learned c and python), but it's clear it didnt know what to do with rpg maker. This is my code and anyhelp would be appreciated. Thank you.
/*:
*@plugindesc Quest Journal System
*@author undergrad chaos
*
*
*@help
*Plugin commands:
*- Add quest [id] [name] [description]
*- Complete quest [id]
*
*@command Add quest
*@arg id
*@type number
*
*@arg name
*@type text
*
*@arg description
*@type text
*
*@command Complete quest
*@arg id
*/
(() => {
var questJournal = questJournal || {};
questJournal.quests = [];
questJournal.addQuest = function(id, name, description) {
questJournal.quests.push({
id: id,
name: name,
description: description,
completed: false
});
};
questJournal.completeQuest = function(id) {
for (let x=0; x < questJournal.quests.length; x++) {
if (questJournal.quests[x].id === id) {
questJournal.quests[x].completed = true;
break;
}
};
};
PluginManager.registerCommand('questJournal', 'Add quest', args => {
console.log("Raw args:", args);
const id = parseInt(args.id, 10 );
console.log("Parsed ID:", id);
if (isNaN(id)) {
console.error("Invalid ID provided: ", args.id);
return;
}
var name = args.name || "Untitled Quest";
var description = args.description || "No Description provided";
console.log(`Add quest command triggered with id: ${id}, name: ${name}, description: ${description}`);
questJournal.addQuest(id, name, description);
});
PluginManager.registerCommand('questJournal', 'Complete quest', args => {
var id = (Number(args.id));
questJournal.completeQuest(id);
});
Hello, maybe someone can help me, I'm having trouble with writing a plugin. I'm trying to make a quest journal, I know that there a few plugins already, however, I want to get experience with programming as I eventually want to be a software developer. My code seems to mostly work for now, however when i try to use plugin commands in event editor I keep getting an error. with console.log I can see the args being passed in, but when I look at the quest in console after that, it says undefined for all my parameters. I tried using an ai to help with debugging and just helping get my start(I mostly learned c and python), but it's clear it didnt know what to do with rpg maker. This is my code and anyhelp would be appreciated. Thank you.
/*:
*@plugindesc Quest Journal System
*@author undergrad chaos
*
*
*@help
*Plugin commands:
*- Add quest [id] [name] [description]
*- Complete quest [id]
*
*@command Add quest
*@arg id
*@type number
*
*@arg name
*@type text
*
*@arg description
*@type text
*
*@command Complete quest
*@arg id
*/
(() => {
var questJournal = questJournal || {};
questJournal.quests = [];
questJournal.addQuest = function(id, name, description) {
questJournal.quests.push({
id: id,
name: name,
description: description,
completed: false
});
};
questJournal.completeQuest = function(id) {
for (let x=0; x < questJournal.quests.length; x++) {
if (questJournal.quests[x].id === id) {
questJournal.quests[x].completed = true;
break;
}
};
};
PluginManager.registerCommand('questJournal', 'Add quest', args => {
console.log("Raw args:", args);
const id = parseInt(args.id, 10 );
console.log("Parsed ID:", id);
if (isNaN(id)) {
console.error("Invalid ID provided: ", args.id);
return;
}
var name = args.name || "Untitled Quest";
var description = args.description || "No Description provided";
console.log(`Add quest command triggered with id: ${id}, name: ${name}, description: ${description}`);
questJournal.addQuest(id, name, description);
});
PluginManager.registerCommand('questJournal', 'Complete quest', args => {
var id = (Number(args.id));
questJournal.completeQuest(id);
});