Jump to content
  • 0

Help, Error npc_event + comparing hourly points scripts.


Amidamaru

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   2
  • Joined:  07/12/17
  • Last Seen:  

Hello Guys,
I really need your help / support for these scripts.

So here's the chronology,

First i am using this hourly points script

Spoiler

-    script    hourlypointss    -1,{
    
    OnInit:
        .max_hour = 5;
        .duration = 3600;
        .npc_name$ = strnpcinfo(3);
        bindatcmd "hourly",    .npc_name$ + "::OnCheck";
        end;
        
    OnClock0000:
        query_sql( "DELETE FROM acc_reg_num` WHERE `key` = '#daily_hour_count' AND `account_id` IN ( SELECT `account_id` FROM `char` WHERE `login` = 0 GROUP BY `account_id` ) " );
        addrid(0);
        #daily_hour_count = -1;
        
    OnUpdate:
        deltimer .npc_name$+"::OnUpdate";
        #daily_hour_count++;
        switch ( #daily_hour_count ) {
            case 1:
                #CASHPOINT += 1;
                getitem 512,1;
                break;
            case 2:
                #CASHPOINT += 2;
                getitem 512,2;
                break;
            case 3:
                #CASHPOINT += 3;
                getitem 512,3;
                break;
            case 4:
                #CASHPOINT += 4;
                getitem 512,4;
                break;
            case 5:
                #CASHPOINT += 5;
                getitem 512,6;
                break;
            default: break;
        }
        
    OnPCLoginEvent:
        if ( #daily_hour_count < .max_hour ) {
            @timer = gettimetick(2) + .duration;
            addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
        }
        if ( #daily_hour_count )    dispbottom "[ Hourly Rewards ] " + #daily_hour_count + "/" + .max_hour + " hour" + ((#daily_hour_count > 1)?"s":"") + " played!",0x9ae2d7;
        end;
        
    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}

The @hourly command is working but until 1 hour. The Cash Point won't add.

So, i tried using another script provided like this:

Spoiler

//===== Hourly Points Script =========================================
//===== By: ==========================================================
//= GorthexTiger modified by Nibi
//===== Current Version: =============================================
//= 1.4.1
//===== Compatible With: =============================================
//= Any eAthena Version
//===== Description: =================================================
//= Get Points every successful hours of gameplay, you cannot get
//= the points even if you miss a second or a minute. A player will
//= get a very big bonus if they played 3 hours consecutively
//= or without logging out of the game. If the player is vending
//= the script will then stop.
//===== Additional Comments: =========================================
//= You can modify the script to your liking.
//= The default points is Kafrapoints change it anyway if you like.
//= 1.1 = Check Chatting too
//= 1.2 = 5 Minute Idle Check & @at/@autotrade check.
//= 1.3 = Corrected the current balance line on 12 Hours Consecutive
//= 1.4 = Added command to check remaining time and updated idle check. (Skorm)
//= 1.4.1 = Modified the msgs to display according to .timer. (Skorm)
//====================================================================
-    script    hourlypoints    -1,{
    
OnPointGet:
    //Check for idle.
    while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
        if( .@mes$ == "" ) {
            dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
            set @hourly_points_timer, 0;
        }
        sleep2 .delay;
    }
    
    @consecutive_timer++;
    .@time_string$ = Time2Str( @consecutive_timer * ( .timer / 1000 ) );
    dispbottom "You received "+.points+" Kafrapoint(s) by staying ingame for "+.@time_string$+".";
    #CASHPOINTS = #CASHPOINTS + .points;
    dispbottom "Current Balance = "+#CASHPOINTS+" Kafrapoints";
    @consecutive_bonus++;

    //Check for consecutive timer.
    if(@consecutive_bonus == .cdelay) {
        @consecutive_bonus = 0;
        #CASHPOINTS = #CASHPOINTS + .cpoints;
        dispbottom "You receive a bonus "+.cpoints+" Kafrapoint(s) by playing for "+.@time_string$+" consecutively!!!";
        dispbottom "Current Balance = "+#CASHPOINTS+" Kafrapoint(s)";
    }
    
OnPCLoginEvent:
    addtimer .timer,"hourlypoints::OnPointGet";
    @hourly_points_timer = gettimetick(2) + ( .timer / 1000 );
    end;
    
OnCmdHour:
    message strcharinfo(0),@hourly_points_timer ? Time2Str( @hourly_points_timer )+" remaining before you get your Hourly Reward(s).":"Something went wrong or you're considered idle at the moment, try relogging!";
    end;

OnInit:
    bindatcmd "ctr","hourlypoints::OnCmdHour"; //@ctr to view time till next point.
    .timer   = 1000*60*60; //Timer in milliseconds. ( Default: 1000*60*60 [ = 1 Hour ] )
    .cdelay  = 3;          //Delay before receiving the consecutive bonus. ( Default: 3 [ { ~ 3 Hours } *Using default timer ] )
    .cpoints = 10;         //Points gained for consecutive time online. ( Default: 10 )
    .points  = 1;          //Normal points gained. ( Default: 1 )
    .delay   = 1000;       //Delay for idle re-check check. ( Default: 1000 [ = 1 Second ] )
    .idle    = 60*5;       //Player is idle after not moving for this many seconds. ( Default: 60*5 [ = 5 Minutes ] )
}

It loads but when i try using @ctr command to check the time remaining. the "Map Server" is reporting an error:

image.png.8889a4aee6d7d756d6936c5562058525.png

[Error]: npc_event: event not found [hourlypoints::OnCmdHour]

Sorry for the long post.

Please help and thank you for helping.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...