Jump to content
  • 0

Hourly Points


UnknownUser0317

Question


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

It's like Hourly Points script but a twist.

If the timer starts, you will have a total of 5 hours per day. the timer will reset at 12 midnight.

1st hour = 10 cash point + red potion

2nd hour = 15  cp + orange potion

3rd hour = 20 cp + yellow potion

4th hour = 25 cp + white potion

5th hour = 30 cp + blue potion

 

if the timer reached total of 5 hours, the timer will stop and wait until 12 midnight for reset.

even i log out, the timer will save.

if the timer is active and i'm playing, and if the time is reached 12 midnight, the timer will reset and will notify the player 'the hourly points reset.'.

and if the character is offline, the timer will reset also.

Link to comment
Share on other sites

14 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

Link to comment
Share on other sites

  • 1

  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   596
  • Joined:  11/25/11
  • Last Seen:  

Very well, I had some spare time, so.

-    script    hourly_point_main    -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;            
}

I've made it on my own coding and aesthetic taste, adapt it as you wish.
Use @hourly to check time left

Edited by Haziel
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

On 11/26/2016 at 6:56 AM, Emistry said:

Hi @Emistry, it's not working.

Git Hash: c88ca44

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

Thanks emistry! It's now working, In addition, how can i add message if how many minutes left before i can claim my next points?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

28 minutes ago, Haziel said:

Very well, I had some spare time, so.
 


-    script    hourly_point_main    -1,{
    
    OnInit:
        .max_hour = 5;
        .duration = 90;
        .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;            
}



I've made it on my own coding and aesthetic taste, adapt it as you wish.

Thank you @Haziel, it's working.

 

@Emistry, you forgot this.

"even i log out, the timer will save."

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

22 hours ago, UnknownUser0317 said:

"even i log out, the timer will save."

updated.

 

18 hours ago, Bringer said:

 i know this off topic can you make dynamic hourly shop too?

You know its off topic, but you still post it .... should the mod reply with "You know you broke the rules, how many warning point you the mod to award you?"

Anyway you can search the forum for any dynamic shop, it's easily found in the forum...

Edited by Emistry
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

31 minutes ago, Emistry said:

updated.

Thank you @Emistry but how can I know if the timer is saving? maybe add a command to check remaining time? Thanks!

Edited by UnknownUser0317
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

10 minutes ago, UnknownUser0317 said:

Thank you @Emistry, but how can I know if the timer is saving? maybe add a command to check remaining time? Thanks!

updated.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  745
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

@Emistry can i request for this?
 

Every Hour you get reward points
After 8 consecutive hours, rewarding will start all over again


First Hour: 10 Rewards Points
Second Hour: 20 Reward Points
Third Hour: 30 Reward Points
Fourth Hour: 40 Reward Points
Fifth Hour: 50 Reward Points
Sixth Hour: 60 Reward Points
7th Hour: 70 Reward Points
8th Hour: 80 Reward Points

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

9 minutes ago, Bringer said:

First Hour: 10 Rewards Points
Second Hour: 20 Reward Points
Third Hour: 30 Reward Points
Fourth Hour: 40 Reward Points
Fifth Hour: 50 Reward Points
Sixth Hour: 60 Reward Points
7th Hour: 70 Reward Points
8th Hour: 80 Reward Points

the script already give reward for 1~5th hours ... just add the 6~8 hours by yourself....

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  745
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

11 minutes ago, Emistry said:

the script already give reward for 1~5th hours ... just add the 6~8 hours by yourself....

After 8 consecutive hours, rewarding will start all over again

can please remove the  12 midnight for reset.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   1
  • Joined:  11/19/16
  • Last Seen:  

8 hours ago, Emistry said:

updated.

@Emistry, i got mysql error when deleting variable #daily_minute_count

[SQL]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '` WHERE `key` = '#daily_minute_count' AND `account_id` IN (SELECT `account_id` F' at line 1
[Debug]: at c:\ragnarok\src\map\script.c:16404 - DELETE FROM `acc_reg_num` WHERE `key` = '#daily_minute_count' AND `account_id` IN (SELECT `account_id` FROM `char` WHERE `login` = 0 GROUP BY `account_id`)
[Debug]: Source (NPC): hourly_point_main (invisible/not on a map)

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  68
  • Topics Per Day:  0.02
  • Content Count:  436
  • Reputation:   31
  • Joined:  02/19/12
  • Last Seen:  

On 11/26/2016 at 6:56 AM, Emistry said:

Hi Emistry, can you change to announce the accumulated every 60min and not every minute?

 

Thanks ~

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  745
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

@Haziel i know this off topic can you make dynamic hourly shop too?

Link to comment
Share on other sites

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...