Jump to content
  • 0

Timer


prada

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  04/08/18
  • Last Seen:  

good day

I want to configure the script to give a package two hours before the start of the woe, being able to receive only once the package.

my woe are set to start woe Wednesday and Sunday at 8:00 p.m.

Can someone help me? thank you

sorry for my english

 

  

Quote

 }
    if( BaseLevel < 99 || Class > 4022 ) {
        mes "Sorry this is for Lvl 99 Trans Class only";
        close;    
    }
    if( gettimetick(2) < #delay ) {
        mes "Sorry, you can only claim this once every WoE";
        close;
    }

 

 

Quote

    set #delay, gettimetick(2)+10800;
    callsub( L_GLSub, .Npc_Name$ );
    mes "There you are, goodluck!";
    close;
    
L_GLSub:
    if( getguildmasterid(getcharid(2)) == getcharid(0) ) {
        mes getarg(0);
        mes "Would you like to claim your guild leader package too?";
        next;
        if( select("Yes:No")==1 )
            switch( gettime(4) ) {
                getitem 19056,1; break;

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   2
  • Joined:  09/24/18
  • Last Seen:  

I think it would be helpful if you're able to give information on what is wrong with the script and the complete function rather than just a chunk of it. Your if( select("Yes:No")==1 ) doesn't have an opening curly braces, that might cause huge logic problems

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  04/08/18
  • Last Seen:  

Sorry! Let me explain better. I am creating a Guild Package and am using this script.

 

My WoE run two days of the week and I would like two hours before WoE the npc deliver the items as soon as the leader requests once each WoE.

https://pastebin.com/tLHkb0rf

 

prontera,100,200,3    script    WoE Supply    78,{
    function sf {
        function s;
        .@a = getarg(2);
        .@len = getarg(3);
        return (
            sprintf( getarg(0),
                s(.@a, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)), 
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)), 
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1))
            )
            +(( .@a+1 < .@len )?":Next":":")
            +(( .@a-11 > 0 )?":Back":":")
            +":Cancel"
        );
        function s {
            if( getarg(0) >= getarg(1) ) return "";
            else {
                .@name$ = getguildname(getelementofarray(getarg(2),getarg(0)));
                return .@name$=="null"?"":.@name$;
            }
        };
    };
    function nex { return((getarg(0)+10)<getarg(1)?getarg(0)+10:getarg(1)-(getarg(1)%10)); };
    function bac { return((getarg(0)-10)>=0?getarg(0)-10:0); };

    if( getgmlevel()>=80 ) {
        mes .Npc_Name$;
        mes "Hello Mr. GM what would you like to do?";
        next;
        switch( select("Add/Remove Guilds:Clear Guild Data:Player Menu:Cancel") ) {
            case 1:
                mes .Npc_Name$;
                mes "Would you like to add or remove a guild?";
                .@a_len = getarraysize($App_Guilds);
                .@format$ = "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s";
                next;
                if( select("Remove:Add") == 1 ) {
                    while( .@a != 9999 ) {
                        select( sf( .@format$, $App_Guilds, .@a, .@a_len ) );
                        switch( @menu ) {
                            case 11: .@a = nex( .@a, .@a_len ); break;
                            case 12: .@a = bac( .@a ); break;
                            case 13: end;
                            
                            default:
                                .@select = .@a+@menu-1;
                                mes .Npc_Name$;
                                mes "You've selected ^0000FF["+getguildname($App_Guilds[.@select])+"]^000000 guild. Would you like to remove them from the accepted guilds?";
                                next;
                                if( select("Yes:No") == 1 ) {
                                    deletearray($App_Guilds[.@select],1);
                                    mes .Npc_Name$;
                                    mes "The guild has been removed!";
                                }
                                close;
                        }
                    }
                } else {
                    mes .Npc_Name$;
                    mes "Please input guild name or masters name.";
                    next;
                    input(.@input$);
                    .@len = query_sql( "Select `guild_id` from `guild` where `name` like '%"+escape_sql(.@input$)+"%' or `master` like '%"+escape_sql(.@input$)+"%';",.@guild_id );
                    while( .@a != 9999 ) {
                        select( sf( .@format$, .@guild_id, .@a, .@len ) );
                        switch( @menu ) {
                            case 11: .@a = nex( .@a, .@len ); break;
                            case 12: .@a = bac( .@a ); break;
                            case 13: end;
                            
                            default:
                                .@select = .@a+@menu-1;
                                .@a_len = getarraysize($App_Guilds);
                                for(.@b=0;.@b<.@a_len;.@b++)
                                    if( $App_Guilds[.@b]==.@guild_id[.@select] ) {
                                        mes .Npc_Name$;
                                        mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. I'm sorry but that guild has already been added to the accepted list.";
                                        close;
                                    }
                                mes .Npc_Name$;
                                mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. Would you like to add them to the accepted guilds?";
                                next;
                                if( select("Yes:No") == 1 ) {
                                    .@a_len = getarraysize($App_Guilds);
                                    if( .@a_len>=128 ) {
                                        mes .Npc_Name$;
                                        mes "I'm sorry but the accepted list is full please make some room and try again...";
                                    } else {
                                        mes .Npc_Name$;
                                        mes "The guild was successfully added!";
                                        $App_Guilds[.@a_len] = .@guild_id[.@select];
                                    }
                                }
                                close;
                        }
                    }
                }
            case 2:
                mes .Npc_Name$;
                mes "Are you sure you want to clear the guild data?!";
                next;
                if( select("Yes!:No!")==1 ) {
                    mes .Npc_Name$;
                    mes "This is you last chance. Are you surly sure as sure can be?";
                    next;
                    if( select("Surly!:No, wait... Where am I?!!")==1 )
                        deletearray($App_Guilds);
                }
                if( @menu==1 ) {
                    mes .Npc_Name$;
                    mes "The deed is done...";
                } else {
                    mes .Npc_Name$;
                    mes "Wow that was a close one... Have a nice day!";
                }
                close;
                
            case 3: break;
            
            case 4:
                mes .Npc_Name$;
                mes "Alright, have a nice day!";
                close;
        }
    }

    mes .Npc_Name$;
    mes "I'm here to give you supplies for WoE!";
    next;
    
    mes .Npc_Name$;
    .@len = getarraysize($App_Guilds);
    for( .@i=0; .@i <= .@len; .@i++ ) {
        if( getcharid(2) == $App_Guilds[.@i] )
            set .@Guild_Check, .@Guild_Check+1;
    }
    if( .@Guild_Check < 1 ) {
        mes "Your guild has not yet been approved, please contact the GMs";
        close;
    }
    if( !getcharid(2) ) {
        mes "Sorry only members of a guild may use this npc.";
        close;    
    }
    if( BaseLevel < 99 || Class > 4022 ) {
        mes "Sorry this is for Lvl 99 Trans Class only";
        close;    
    }
    if( gettimetick(2) < #delay ) {
        mes "Sorry, you can only claim this once every WoE";
        close;
    }
    switch( Class ) {
        case 4009: //High Priest
            getitem 19052,1; //HP Pack
            break;
        case 4010: //High Wizard
            mes "Please choose your role";
            mes "Support : Ganbantien";
            mes "Offensive : SG/MS/LOV (Includes Crystal Fragments)";
            next;
            if( select("Support High Wizard:Offensive High Wizard")==1 )
                getitem 19047,1; //Support HWIZ Pack
            else
                getitem 19046,1; //Offensive HWIZ Pack
            break;
        case 4011: //Whitesmith
            getitem 19051,1; //Whitesmith Pack
            break;
        case 4012: //Sniper
            getitem 19054,1; //Sniper Pack
            break;
        case 4013: //Sinx
            getitem 19055,1; //Sinx Pack
            break;
        case 4016: //Champion
            getitem 19053,1; //Champion Pack
            break;
        case 4017: //Professor
            getitem 19048,1; //Prof Pack
            break;
        case 4018: //Stalker
            mes "Please choose your type.";
            mes "Flame : Flame Stone";
            mes "Ice : Ice Stone";
            mes "Wind : Wind Stone";
            mes "Shadow : Shadow Orb";
            next;
            switch( select("Flame:Ice:Wind:Shadow") ) {
                case 1: getitem 19056,1; break;
                case 2: getitem 19057,1; break;
                case 3: getitem 19058,1; break;
                case 4: getitem 19059,1;
            }
            break;
        case 4019: //Creator
            mes "Please choose your role.";
            mes "Support : Slim Potion Pitcher";
            mes "Offensive : Acid Demonstration";
            next;
            if( select("Support Creator:Offensive Creator")==1 )
                getitem 19050,1;
            else
                getitem 19049,1;
            break;
        case 25: //Ninja
            mes "Please choose your type.";
            mes "Flame : Flame Stone";
            mes "Ice : Ice Stone";
            mes "Wind : Wind Stone";
            mes "Shadow : Shadow Orb";
            next;
            switch( select("Flame:Ice:Wind:Shadow") ) {
                case 1: getitem 19056,1; break;
                case 2: getitem 19057,1; break;
                case 3: getitem 19058,1; break;
                case 4: getitem 19059,1;
            }
            break;
        //Add more cases for all classes
        default:
            if( !callsub( L_GLSub, .Npc_Name$ ) )
                mes "Sorry this is only for the classes which require items for using skills.";
            close; 
    }
    set #delay, gettimetick(2)+10800;
    callsub( L_GLSub, .Npc_Name$ );
    mes "There you are, goodluck!";
    close;
    
L_GLSub:
    if( getguildmasterid(getcharid(2)) == getcharid(0) ) {
        mes getarg(0);
        mes "Would you like to claim your guild leader package too?";
        next;
        if( select("Yes:No")==1 )
            switch( gettime(4) ) {
                case 0: getitem 19056,1; break; //Sunday
                case 1: getitem 19056,1; break; //Monday
                case 2: getitem 19056,1; break; //Tuesday
                case 3: getitem 19056,1; break; //Wednesday
                case 4: getitem 19056,1; break; //Thursday
                case 5: getitem 19056,1; break; //Friday
                case 6: getitem 19056,1; //Saturday
            }
        return 1;
    }
    return 0;

OnInit:
    set .Npc_Name$, "[^0000FF WoE Supply ^000000]";
    end;
}
Quote

prontera,100,200,3    script    WoE Supply    78,{
    function sf {
        function s;
        .@a = getarg(2);
        .@len = getarg(3);
        return (
            sprintf( getarg(0),
                s(.@a, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)), 
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)), 
                s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1))
            )
            +(( .@a+1 < .@len )?":Next":":")
            +(( .@a-11 > 0 )?":Back":":")
            +":Cancel"
        );
        function s {
            if( getarg(0) >= getarg(1) ) return "";
            else {
                .@name$ = getguildname(getelementofarray(getarg(2),getarg(0)));
                return .@name$=="null"?"":.@name$;
            }
        };
    };
    function nex { return((getarg(0)+10)<getarg(1)?getarg(0)+10:getarg(1)-(getarg(1)%10)); };
    function bac { return((getarg(0)-10)>=0?getarg(0)-10:0); };

    if( getgmlevel()>=80 ) {
        mes .Npc_Name$;
        mes "Hello Mr. GM what would you like to do?";
        next;
        switch( select("Add/Remove Guilds:Clear Guild Data:Player Menu:Cancel") ) {
            case 1:
                mes .Npc_Name$;
                mes "Would you like to add or remove a guild?";
                .@a_len = getarraysize($App_Guilds);
                .@format$ = "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s";
                next;
                if( select("Remove:Add") == 1 ) {
                    while( .@a != 9999 ) {
                        select( sf( .@format$, $App_Guilds, .@a, .@a_len ) );
                        switch( @menu ) {
                            case 11: .@a = nex( .@a, .@a_len ); break;
                            case 12: .@a = bac( .@a ); break;
                            case 13: end;
                            
                            default:
                                .@select = .@a+@menu-1;
                                mes .Npc_Name$;
                                mes "You've selected ^0000FF["+getguildname($App_Guilds[.@select])+"]^000000 guild. Would you like to remove them from the accepted guilds?";
                                next;
                                if( select("Yes:No") == 1 ) {
                                    deletearray($App_Guilds[.@select],1);
                                    mes .Npc_Name$;
                                    mes "The guild has been removed!";
                                }
                                close;
                        }
                    }
                } else {
                    mes .Npc_Name$;
                    mes "Please input guild name or masters name.";
                    next;
                    input(.@input$);
                    .@len = query_sql( "Select `guild_id` from `guild` where `name` like '%"+escape_sql(.@input$)+"%' or `master` like '%"+escape_sql(.@input$)+"%';",.@guild_id );
                    while( .@a != 9999 ) {
                        select( sf( .@format$, .@guild_id, .@a, .@len ) );
                        switch( @menu ) {
                            case 11: .@a = nex( .@a, .@len ); break;
                            case 12: .@a = bac( .@a ); break;
                            case 13: end;
                            
                            default:
                                .@select = .@a+@menu-1;
                                .@a_len = getarraysize($App_Guilds);
                                for(.@b=0;.@b<.@a_len;.@b++)
                                    if( $App_Guilds[.@b]==.@guild_id[.@select] ) {
                                        mes .Npc_Name$;
                                        mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. I'm sorry but that guild has already been added to the accepted list.";
                                        close;
                                    }
                                mes .Npc_Name$;
                                mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. Would you like to add them to the accepted guilds?";
                                next;
                                if( select("Yes:No") == 1 ) {
                                    .@a_len = getarraysize($App_Guilds);
                                    if( .@a_len>=128 ) {
                                        mes .Npc_Name$;
                                        mes "I'm sorry but the accepted list is full please make some room and try again...";
                                    } else {
                                        mes .Npc_Name$;
                                        mes "The guild was successfully added!";
                                        $App_Guilds[.@a_len] = .@guild_id[.@select];
                                    }
                                }
                                close;
                        }
                    }
                }
            case 2:
                mes .Npc_Name$;
                mes "Are you sure you want to clear the guild data?!";
                next;
                if( select("Yes!:No!")==1 ) {
                    mes .Npc_Name$;
                    mes "This is you last chance. Are you surly sure as sure can be?";
                    next;
                    if( select("Surly!:No, wait... Where am I?!!")==1 )
                        deletearray($App_Guilds);
                }
                if( @menu==1 ) {
                    mes .Npc_Name$;
                    mes "The deed is done...";
                } else {
                    mes .Npc_Name$;
                    mes "Wow that was a close one... Have a nice day!";
                }
                close;
                
            case 3: break;
            
            case 4:
                mes .Npc_Name$;
                mes "Alright, have a nice day!";
                close;
        }
    }

    mes .Npc_Name$;
    mes "I'm here to give you supplies for WoE!";
    next;
    
    mes .Npc_Name$;
    .@len = getarraysize($App_Guilds);
    for( .@i=0; .@i <= .@len; .@i++ ) {
        if( getcharid(2) == $App_Guilds[.@i] )
            set .@Guild_Check, .@Guild_Check+1;
    }
    if( .@Guild_Check < 1 ) {
        mes "Your guild has not yet been approved, please contact the GMs";
        close;
    }
    if( !getcharid(2) ) {
        mes "Sorry only members of a guild may use this npc.";
        close;    
    }
    if( BaseLevel < 99 || Class > 4022 ) {
        mes "Sorry this is for Lvl 99 Trans Class only";
        close;    
    }
    if( gettimetick(2) < #delay ) {
        mes "Sorry, you can only claim this once every WoE";
        close;
    }
    switch( Class ) {
        case 4009: //High Priest
            getitem 19052,1; //HP Pack
            break;
        case 4010: //High Wizard
            mes "Please choose your role";
            mes "Support : Ganbantien";
            mes "Offensive : SG/MS/LOV (Includes Crystal Fragments)";
            next;
            if( select("Support High Wizard:Offensive High Wizard")==1 )
                getitem 19047,1; //Support HWIZ Pack
            else
                getitem 19046,1; //Offensive HWIZ Pack
            break;
        case 4011: //Whitesmith
            getitem 19051,1; //Whitesmith Pack
            break;
        case 4012: //Sniper
            getitem 19054,1; //Sniper Pack
            break;
        case 4013: //Sinx
            getitem 19055,1; //Sinx Pack
            break;
        case 4016: //Champion
            getitem 19053,1; //Champion Pack
            break;
        case 4017: //Professor
            getitem 19048,1; //Prof Pack
            break;
        case 4018: //Stalker
            mes "Please choose your type.";
            mes "Flame : Flame Stone";
            mes "Ice : Ice Stone";
            mes "Wind : Wind Stone";
            mes "Shadow : Shadow Orb";
            next;
            switch( select("Flame:Ice:Wind:Shadow") ) {
                case 1: getitem 19056,1; break;
                case 2: getitem 19057,1; break;
                case 3: getitem 19058,1; break;
                case 4: getitem 19059,1;
            }
            break;
        case 4019: //Creator
            mes "Please choose your role.";
            mes "Support : Slim Potion Pitcher";
            mes "Offensive : Acid Demonstration";
            next;
            if( select("Support Creator:Offensive Creator")==1 )
                getitem 19050,1;
            else
                getitem 19049,1;
            break;
        case 25: //Ninja
            mes "Please choose your type.";
            mes "Flame : Flame Stone";
            mes "Ice : Ice Stone";
            mes "Wind : Wind Stone";
            mes "Shadow : Shadow Orb";
            next;
            switch( select("Flame:Ice:Wind:Shadow") ) {
                case 1: getitem 19056,1; break;
                case 2: getitem 19057,1; break;
                case 3: getitem 19058,1; break;
                case 4: getitem 19059,1;
            }
            break;
        //Add more cases for all classes
        default:
            if( !callsub( L_GLSub, .Npc_Name$ ) )
                mes "Sorry this is only for the classes which require items for using skills.";
            close; 
    }
    set #delay, gettimetick(2)+10800;
    callsub( L_GLSub, .Npc_Name$ );
    mes "There you are, goodluck!";
    close;
    
L_GLSub:
    if( getguildmasterid(getcharid(2)) == getcharid(0) ) {
        mes getarg(0);
        mes "Would you like to claim your guild leader package too?";
        next;
        if( select("Yes:No")==1 )
            switch( gettime(4) ) {
                case 0: getitem 19056,1; break; //Sunday
                case 1: getitem 19056,1; break; //Monday
                case 2: getitem 19056,1; break; //Tuesday
                case 3: getitem 19056,1; break; //Wednesday
                case 4: getitem 19056,1; break; //Thursday
                case 5: getitem 19056,1; break; //Friday
                case 6: getitem 19056,1; //Saturday
            }
        return 1;
    }
    return 0;

OnInit:
    set .Npc_Name$, "[^0000FF WoE Supply ^000000]";
    end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  91
  • Reputation:   22
  • Joined:  10/24/14
  • Last Seen:  

Trigger 2 times a week in certain time and gives all available players a packet/item/etc.

Or with a GM command @woebonus

-	script	#atcmd_woebonus	-1,{
OnInit:
	bindatcmd "woebonus", strnpcinfo(3)+"::OnAtCommand",10,10;
	end;

OnAtCommand:
	showscript "WoE Bonus!!", getcharid(3), SELF;
OnSun1600: // Every Sunday 4:00pm
OnWed1600: // Every Wednesday 4:00pm
	// Attach all available players
	addrid(0);

	// Give package/items/etc.
	getitem 501,1;

	// Announce current player about it
	announce "WoE Bonus Received!",BC_SELF,0x00FF00;
	end;
}

Oops, forgot about this part:

Quote

the npc deliver the items as soon as the leader requests once each WoE.

:ani_swt3:

Edited by Sehrentos
Fix1
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...