• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Regestire all monster and players in creatureevent.xml

mmheo

New Member
Joined
Sep 14, 2017
Messages
157
Reaction score
1
hello guys i have to use this
Feature - [CreatureEvent] Regestire all monster and players in creatureevent.xml

but when add this cod

Code:
std::string strr;
if(!readXMLString(p, "registerTo", strr) || strr.empty() ){
if((tmpStr != "login") && (tmpStr != "logout"))
std::clog << "[Warning - CreatureEvent::configureEvent] : You havn't register event '" << m_eventName <<"'"<< std::endl;
}
else
m_eventRegister = strr;

here
Code:
bool CreatureEvent::configureEvent(xmlNodePtr p)
{
    std::string str;
    if(!readXMLString(p, "name", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No name for creature event." << std::endl;
        return false;
    }

    m_eventName = str;
    if(!readXMLString(p, "type", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No type for creature event." << std::endl;
        return false;
    }

    m_type = g_creatureEvents->getType(str);
    if(m_type == CREATURE_EVENT_NONE)
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No valid type for creature event." << str << std::endl;
        return false;
    }

    m_isLoaded = true;
    return true;
}

std::string CreatureEvent::getScriptEventName() const
{
    switch(m_type)
    {
        case CREATURE_EVENT_LOGIN:
            return "onLogin";
        case CREATURE_EVENT_LOGOUT:
            return "onLogout";
        case CREATURE_EVENT_CHANNEL_JOIN:
            return "onJoinChannel";
        case CREATURE_EVENT_MOVEITEM:
            return "onMoveItem";
        case CREATURE_EVENT_MOVE:
           return "onMove";
        case CREATURE_EVENT_CHANNEL_LEAVE:
            return "onLeaveChannel";
        case CREATURE_EVENT_THINK:
            return "onThink";
        case CREATURE_EVENT_ADVANCE:
            return "onAdvance";
        case CREATURE_EVENT_LOOK:
            return "onLook";
        case CREATURE_EVENT_DIRECTION:
            return "onDirection";
        case CREATURE_EVENT_OUTFIT:
            return "onOutfit";
        case CREATURE_EVENT_MAIL_SEND:
            return "onSendMail";
        case CREATURE_EVENT_MAIL_RECEIVE:
            return "onReceiveMail";
        case CREATURE_EVENT_TRADE_REQUEST:
            return "onTradeRequest";
        case CREATURE_EVENT_TRADE_ACCEPT:
            return "onTradeAccept";
        case CREATURE_EVENT_TEXTEDIT:
            return "onTextEdit";
        case CREATURE_EVENT_REPORTBUG:
            return "onReportBug";
        case CREATURE_EVENT_STATSCHANGE:
            return "onStatsChange";
        case CREATURE_EVENT_COMBAT_AREA:
            return "onAreaCombat";
        case CREATURE_EVENT_PUSH:
            return "onPush";
        case CREATURE_EVENT_TARGET:
            return "onTarget";
        case CREATURE_EVENT_FOLLOW:
            return "onFollow";
        case CREATURE_EVENT_COMBAT:
            return "onCombat";
        case CREATURE_EVENT_ATTACK:
            return "onAttack";
        case CREATURE_EVENT_CAST:
            return "onCast";
        case CREATURE_EVENT_KILL:
            return "onKill";
        case CREATURE_EVENT_DEATH:
            return "onDeath";
        case CREATURE_EVENT_PREPAREDEATH:
            return "onPrepareDeath";
        case CREATURE_EVENT_SPAWN:
             return "onSpawn";
            case CREATURE_EVENT_THROW:
            return "onThrow";
        case CREATURE_EVENT_CHANNEL_REQUEST:
            return "onChannelRequest";
        case CREATURE_EVENT_NONE:
        default:
            break;
    }

    return "";
}

get this error

expected unqualified-id before "if"

0.4

anyone can help me to add this cod in bool CreatureEvent i posted up
 
C++:
bool CreatureEvent::configureEvent(xmlNodePtr p)
{
    std::string str;
    if (!readXMLString(p, "registerTo", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No registry type for creature event." << std::endl;
        return false;
    }
    m_eventRegister = str;

    if(!readXMLString(p, "name", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No name for creature event." << std::endl;
        return false;
    }

    m_eventName = str;
    if(!readXMLString(p, "type", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No type for creature event." << std::endl;
        return false;
    }

    m_type = g_creatureEvents->getType(str);
    if(m_type == CREATURE_EVENT_NONE)
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No valid type for creature event." << str << std::endl;
        return false;
    }

    m_isLoaded = true;
    return true;
}
 
C++:
bool CreatureEvent::configureEvent(xmlNodePtr p)
{
    std::string str;
    if (!readXMLString(p, "registerTo", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No registry type for creature event." << std::endl;
        return false;
    }
    m_eventRegister = str;

    if(!readXMLString(p, "name", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No name for creature event." << std::endl;
        return false;
    }

    m_eventName = str;
    if(!readXMLString(p, "type", str))
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No type for creature event." << std::endl;
        return false;
    }

    m_type = g_creatureEvents->getType(str);
    if(m_type == CREATURE_EVENT_NONE)
    {
        std::clog << "[Error - CreatureEvent::configureEvent] No valid type for creature event." << str << std::endl;
        return false;
    }

    m_isLoaded = true;
    return true;
}

im so sorry i need this code here
Code:
CreatureEventType_t CreatureEvents::getType(const std::string& type)
{
    CreatureEventType_t m_type = CREATURE_EVENT_NONE;
    std::string tmpStr = asLowerCaseString(type);

    if(tmpStr == "login")
        m_type = CREATURE_EVENT_LOGIN;
    else if(tmpStr == "logout")
        m_type = CREATURE_EVENT_LOGOUT;
    else if(tmpStr == "joinchannel")
        m_type = CREATURE_EVENT_CHANNEL_JOIN;
    else if(tmpStr == "leavechannel")
        m_type = CREATURE_EVENT_CHANNEL_LEAVE;
    else if(tmpStr == "advance")
        m_type = CREATURE_EVENT_ADVANCE;
    else if(tmpStr == "sendmail")
        m_type = CREATURE_EVENT_MAIL_SEND;
    else if(tmpStr == "receivemail")
        m_type = CREATURE_EVENT_MAIL_RECEIVE;
    else if(tmpStr == "traderequest")
        m_type = CREATURE_EVENT_TRADE_REQUEST;
    else if(tmpStr == "tradeaccept")
        m_type = CREATURE_EVENT_TRADE_ACCEPT;
    else if(tmpStr == "textedit")
        m_type = CREATURE_EVENT_TEXTEDIT;
    else if(tmpStr == "reportbug")
        m_type = CREATURE_EVENT_REPORTBUG;
    else if(tmpStr == "look")
        m_type = CREATURE_EVENT_LOOK;
    else if(tmpStr == "think")
        m_type = CREATURE_EVENT_THINK;
    else if(tmpStr == "direction")
        m_type = CREATURE_EVENT_DIRECTION;
    else if(tmpStr == "outfit")
        m_type = CREATURE_EVENT_OUTFIT;
    else if(tmpStr == "statschange")
        m_type = CREATURE_EVENT_STATSCHANGE;
    else if(tmpStr == "areacombat")
        m_type = CREATURE_EVENT_COMBAT_AREA;  
    else if(tmpStr == "push")
        m_type = CREATURE_EVENT_PUSH;
    else if(tmpStr == "target")
        m_type = CREATURE_EVENT_TARGET;
    else if(tmpStr == "follow")
        m_type = CREATURE_EVENT_FOLLOW;
    else if(tmpStr == "combat")
        m_type = CREATURE_EVENT_COMBAT;
    else if(tmpStr == "attack")
        m_type = CREATURE_EVENT_ATTACK;
    else if(tmpStr == "cast")
        m_type = CREATURE_EVENT_CAST;
    else if(tmpStr == "kill")
        m_type = CREATURE_EVENT_KILL;
    else if(tmpStr == "death")
        m_type = CREATURE_EVENT_DEATH;
    else if(tmpStr == "preparedeath")
        m_type = CREATURE_EVENT_PREPAREDEATH;
    else if(tmpStr == "Spawn")
        m_type = CREATURE_EVENT_SPAWN;
    else if(tmpStr == "moveitem")
        m_type =  CREATURE_EVENT_MOVEITEM;
    else if(tmpStr == "throw")
        m_type = CREATURE_EVENT_THROW;
    else if(tmpStr == "channelrequest")
        m_type = CREATURE_EVENT_CHANNEL_REQUEST;

    return m_type;
}

after

std::string tmpStr = asLowerCaseString(type);

im so sorry
 
literally doesn't make sense that it goes there, he must have made a mistake
it belongs in configureEvent, getType has nothing to do with registering to a specific creature type
getType doesn't even have xmlNodePtr, it's impossible to read the value from p inside of getType
 
Back
Top