Jump to content
  • 0

PLEASE HELP WITH MY BANKER SCRIPT


Question

Posted (edited)
Spoiler

prt_in,43,109,4 script  Prontera#Banker 105,{

    OnInit:
        set .maxLoan, 10000000;
        set .interestRate, 0.05;
        set .bankName, "Prontera Bank Inc.";
        set .bankLocation, "Prontera";
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnPCLoginEvent:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
            addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnAdvertise:
        announce "Visit " + .bankName + " located in " + .bankLocation + " for all your banking needs!", bc_all;
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnRemind:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
        }
        end;

    OnBroadcast:
        if (#LOANAMOUNT > 0) {
            announce "Player " + strcharinfo(0) + " has failed to repay their loan of " + #LOANAMOUNT + " zeny within 24 hours!", bc_all;
            addtimer 1800000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnTalk:
        mes "[Banker]";
        mes "Hello! I am the banker from " + .bankName + ". How can I help you today?";
        next;
        switch(select("Loan Zeny:Pay Loan:Cancel")) {
            case 1:
                if (#LOANAMOUNT > 0) {
                    mes "[Banker]";
                    mes "You already have an outstanding loan of " + #LOANAMOUNT + " zeny.";
                    close;
                }
                mes "[Banker]";
                mes "How much zeny would you like to loan? The maximum amount is " + .maxLoan + " zeny.";
                input .loanAmount;
                if (.loanAmount > .maxLoan) {
                    mes "[Banker]";
                    mes "I'm sorry, but the maximum loan amount is " + .maxLoan + " zeny.";
                    close;
                }
                #LOANAMOUNT = .loanAmount;
                Zeny += .loanAmount;
                mes "[Banker]";
                mes "You have successfully loaned " + .loanAmount + " zeny. Please remember to pay it back with interest.";
                addtimer 3600000, strnpcinfo(0) + "::OnRemind";
                addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
                close;
            case 2:
                if (#LOANAMOUNT == 0) {
                    mes "[Banker]";
                    mes "You do not have any outstanding loans.";
                    close;
                }
                .paybackAmount = #LOANAMOUNT * (1 + .interestRate);
                if (Zeny < .paybackAmount) {
                    mes "[Banker]";
                    mes "You do not have enough zeny to pay back your loan. You need " + .paybackAmount + " zeny.";
                    close;
                }
                Zeny -= .paybackAmount;
                #LOANAMOUNT = 0;
                mes "[Banker]";
                mes "You have successfully paid back your loan with interest. Thank you for your business!";
                close;
            case 3:
                mes "[Banker]";
                mes "Goodbye!";
                close;
        }
}

Spoiler

 

 

Please Help ???

It seems my code is not working at all i cant see whats wrong

 npc_parsesrcfile: Unknown syntax in file 'npc/jobs/banker.txt', line '1'. Stopping...
 * w1=prt_in,43,109,4 script  Prontera Banker   894,{

Edited by hikoshijiro

11 answers to this question

Recommended Posts

  • 0
Posted

Sorry my bad i didny include it in the code, i already edit it but here's btw

prt_in,43,109,4 script  Prontera#Banker 105,{

    OnInit:
        set .maxLoan, 10000000;
        set .interestRate, 0.05;
        set .bankName, "Prontera Bank Inc.";
        set .bankLocation, "Prontera";
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnPCLoginEvent:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
            addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnAdvertise:
        announce "Visit " + .bankName + " located in " + .bankLocation + " for all your banking needs!", bc_all;
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnRemind:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
        }
        end;

    OnBroadcast:
        if (#LOANAMOUNT > 0) {
            announce "Player " + strcharinfo(0) + " has failed to repay their loan of " + #LOANAMOUNT + " zeny within 24 hours!", bc_all;
            addtimer 1800000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnTalk:
        mes "[Banker]";
        mes "Hello! I am the banker from " + .bankName + ". How can I help you today?";
        next;
        switch(select("Loan Zeny:Pay Loan:Cancel")) {
            case 1:
                if (#LOANAMOUNT > 0) {
                    mes "[Banker]";
                    mes "You already have an outstanding loan of " + #LOANAMOUNT + " zeny.";
                    close;
                }
                mes "[Banker]";
                mes "How much zeny would you like to loan? The maximum amount is " + .maxLoan + " zeny.";
                input .loanAmount;
                if (.loanAmount > .maxLoan) {
                    mes "[Banker]";
                    mes "I'm sorry, but the maximum loan amount is " + .maxLoan + " zeny.";
                    close;
                }
                #LOANAMOUNT = .loanAmount;
                Zeny += .loanAmount;
                mes "[Banker]";
                mes "You have successfully loaned " + .loanAmount + " zeny. Please remember to pay it back with interest.";
                addtimer 3600000, strnpcinfo(0) + "::OnRemind";
                addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
                close;
            case 2:
                if (#LOANAMOUNT == 0) {
                    mes "[Banker]";
                    mes "You do not have any outstanding loans.";
                    close;
                }
                .paybackAmount = #LOANAMOUNT * (1 + .interestRate);
                if (Zeny < .paybackAmount) {
                    mes "[Banker]";
                    mes "You do not have enough zeny to pay back your loan. You need " + .paybackAmount + " zeny.";
                    close;
                }
                Zeny -= .paybackAmount;
                #LOANAMOUNT = 0;
                mes "[Banker]";
                mes "You have successfully paid back your loan with interest. Thank you for your business!";
                close;
            case 3:
                mes "[Banker]";
                mes "Goodbye!";
                close;
        }
}

 

  • 0
Posted
58 minutes ago, hikoshijiro said:

Sorry my bad i didny include it in the code, i already edit it but here's btw

prt_in,43,109,4 script  Prontera#Banker 105,{

    OnInit:
        set .maxLoan, 10000000;
        set .interestRate, 0.05;
        set .bankName, "Prontera Bank Inc.";
        set .bankLocation, "Prontera";
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnPCLoginEvent:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
            addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnAdvertise:
        announce "Visit " + .bankName + " located in " + .bankLocation + " for all your banking needs!", bc_all;
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnRemind:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
        }
        end;

    OnBroadcast:
        if (#LOANAMOUNT > 0) {
            announce "Player " + strcharinfo(0) + " has failed to repay their loan of " + #LOANAMOUNT + " zeny within 24 hours!", bc_all;
            addtimer 1800000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnTalk:
        mes "[Banker]";
        mes "Hello! I am the banker from " + .bankName + ". How can I help you today?";
        next;
        switch(select("Loan Zeny:Pay Loan:Cancel")) {
            case 1:
                if (#LOANAMOUNT > 0) {
                    mes "[Banker]";
                    mes "You already have an outstanding loan of " + #LOANAMOUNT + " zeny.";
                    close;
                }
                mes "[Banker]";
                mes "How much zeny would you like to loan? The maximum amount is " + .maxLoan + " zeny.";
                input .loanAmount;
                if (.loanAmount > .maxLoan) {
                    mes "[Banker]";
                    mes "I'm sorry, but the maximum loan amount is " + .maxLoan + " zeny.";
                    close;
                }
                #LOANAMOUNT = .loanAmount;
                Zeny += .loanAmount;
                mes "[Banker]";
                mes "You have successfully loaned " + .loanAmount + " zeny. Please remember to pay it back with interest.";
                addtimer 3600000, strnpcinfo(0) + "::OnRemind";
                addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
                close;
            case 2:
                if (#LOANAMOUNT == 0) {
                    mes "[Banker]";
                    mes "You do not have any outstanding loans.";
                    close;
                }
                .paybackAmount = #LOANAMOUNT * (1 + .interestRate);
                if (Zeny < .paybackAmount) {
                    mes "[Banker]";
                    mes "You do not have enough zeny to pay back your loan. You need " + .paybackAmount + " zeny.";
                    close;
                }
                Zeny -= .paybackAmount;
                #LOANAMOUNT = 0;
                mes "[Banker]";
                mes "You have successfully paid back your loan with interest. Thank you for your business!";
                close;
            case 3:
                mes "[Banker]";
                mes "Goodbye!";
                close;
        }
}

 

Try this

prt_in,43,109,4	script	Prontera Banker	105,{

    OnInit:
        set .maxLoan, 10000000;
        set .interestRate, 0.05;
        set .bankName, "Prontera Bank Inc.";
        set .bankLocation, "Prontera";
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnPCLoginEvent:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
            addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnAdvertise:
        announce "Visit " + .bankName + " located in " + .bankLocation + " for all your banking needs!", bc_all;
        addtimer 7200000, strnpcinfo(0) + "::OnAdvertise";
        end;

    OnRemind:
        if (#LOANAMOUNT > 0) {
            dispbottom "Banker: You have an outstanding loan of " + #LOANAMOUNT + " zeny. Please remember to pay it back with interest.";
            addtimer 3600000, strnpcinfo(0) + "::OnRemind";
        }
        end;

    OnBroadcast:
        if (#LOANAMOUNT > 0) {
            announce "Player " + strcharinfo(0) + " has failed to repay their loan of " + #LOANAMOUNT + " zeny within 24 hours!", bc_all;
            addtimer 1800000, strnpcinfo(0) + "::OnBroadcast";
        }
        end;

    OnTalk:
        mes "[Banker]";
        mes "Hello! I am the banker from " + .bankName + ". How can I help you today?";
        next;
        switch(select("Loan Zeny:Pay Loan:Cancel")) {
            case 1:
                if (#LOANAMOUNT > 0) {
                    mes "[Banker]";
                    mes "You already have an outstanding loan of " + #LOANAMOUNT + " zeny.";
                    close;
                }
                mes "[Banker]";
                mes "How much zeny would you like to loan? The maximum amount is " + .maxLoan + " zeny.";
                input .loanAmount;
                if (.loanAmount > .maxLoan) {
                    mes "[Banker]";
                    mes "I'm sorry, but the maximum loan amount is " + .maxLoan + " zeny.";
                    close;
                }
                #LOANAMOUNT = .loanAmount;
                Zeny += .loanAmount;
                mes "[Banker]";
                mes "You have successfully loaned " + .loanAmount + " zeny. Please remember to pay it back with interest.";
                addtimer 3600000, strnpcinfo(0) + "::OnRemind";
                addtimer 86400000, strnpcinfo(0) + "::OnBroadcast";
                close;
            case 2:
                if (#LOANAMOUNT == 0) {
                    mes "[Banker]";
                    mes "You do not have any outstanding loans.";
                    close;
                }
                .paybackAmount = #LOANAMOUNT * (1 + .interestRate);
                if (Zeny < .paybackAmount) {
                    mes "[Banker]";
                    mes "You do not have enough zeny to pay back your loan. You need " + .paybackAmount + " zeny.";
                    close;
                }
                Zeny -= .paybackAmount;
                #LOANAMOUNT = 0;
                mes "[Banker]";
                mes "You have successfully paid back your loan with interest. Thank you for your business!";
                close;
            case 3:
                mes "[Banker]";
                mes "Goodbye!";
                close;
        }
}

 

  • 0
Posted

Thank you for the reply,

but i still got the error that state: npc_parsesrcfile: Unknown syntax in file 'npc/jobs/banker.txt', line '1'. Stopping...
 * w1=prt_in,43,109,4 script  Prontera Banker 105,{
 * w2=
 * w3=
 * w4=

  • 0
Posted
1 hour ago, hikoshijiro said:

Thank you for the reply,

but i still got the error that state: npc_parsesrcfile: Unknown syntax in file 'npc/jobs/banker.txt', line '1'. Stopping...
 * w1=prt_in,43,109,4 script  Prontera Banker 105,{
 * w2=
 * w3=
 * w4=

Replace the <tab> here
prt_in,43,109,4<tab>script<tab>Prontera Banker<tab>105,{

  • 0
Posted
2 hours ago, hikoshijiro said:

Thank you for the reply,

but i still got the error that state: npc_parsesrcfile: Unknown syntax in file 'npc/jobs/banker.txt', line '1'. Stopping...
 * w1=prt_in,43,109,4 script  Prontera Banker 105,{
 * w2=
 * w3=
 * w4=

this is the message at my map server

image.png.8ea9d5aa57275d5caa99c051a9b46ede.png

  • 0
Posted

What I see from the script code, when player click the npc it will go run script label OnInit to the end thats why NPC is not responding.

You should move up the label OnTalk section. so it will respond.

Also you should replace addtimer on OnInit label with initnpctimer, from what I see your NPC need is timer that not need to be attached to player.

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...