Jump to content
  • 0

PLEASE HELP WITH MY BANKER SCRIPT


hikoshijiro

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.01
  • Content Count:  26
  • Reputation:   1
  • Joined:  03/29/23
  • Last Seen:  

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
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  132
  • Reputation:   53
  • Joined:  06/02/12
  • Last Seen:  

Hi. Where's the code?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.01
  • Content Count:  26
  • Reputation:   1
  • Joined:  03/29/23
  • Last Seen:  

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

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1191
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

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

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.01
  • Content Count:  26
  • Reputation:   1
  • Joined:  03/29/23
  • Last Seen:  

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=

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   36
  • Joined:  05/15/20
  • Last Seen:  

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,{

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1191
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.01
  • Content Count:  26
  • Reputation:   1
  • Joined:  03/29/23
  • Last Seen:  

i cant even do the code right ???

im sorry im noob???

image.png.7728a764e365846ce072b387aa5fe3b0.png

Edited by hikoshijiro
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1191
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

i'm sorry, i'm forget to tell you about that error.

please change 0.05 into 0,05

Edited by hendra814
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.01
  • Content Count:  26
  • Reputation:   1
  • Joined:  03/29/23
  • Last Seen:  

now its ok but the npc is not responding ?

image.png.aa59ea6dc634e52959976e68288f14b1.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

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.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.01
  • Content Count:  26
  • Reputation:   1
  • Joined:  03/29/23
  • Last Seen:  

thank you very much for the dear sirs.

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