Jump to content
  • 0

Help for Simple Bank Note NPC


Whathell

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  116
  • Reputation:   4
  • Joined:  01/11/12
  • Last Seen:  

Hi! Well I was writing this simple script here, It is a banker that exchanges bank notes to 1 Million Zeny and vice versa.

Well, the problem is that it changes bank notes to zeny smoothly ( tried changing tens , hundreds and thousands -- no problems). The problem starts when i tried changing zeny into bank notes -- it only changes a maximum of 10 Bank Notes (10 Million Zeny per transaction). Hope you can tell me what I should do to fix this. Here is my script:


prontera,147,184,4 script Banker 833,{
//|==========Settings==============================
set @npcname$,"^ff0000[banker]^000000";
set @banknoteprice,1000000;
set @banknoteid,7922;
//|================================================
mes @npcname$;
mes "Hi "+ strcharinfo(0) +", I can change your bank notes into zeny, and vice versa.";
mes "Each bank note is worth 1 Million Zeny.";
next;
mes @npcname$;
mes "So tell me,what can i do for you?";
switch(select("Exchange Bank Notes to Zeny:Exchange Zeny to Bank Notes")) {
case 1:
next;
mes @npcname$;
mes "Please put in the amount of Bank Notes you want to exchange:";
next;
input @banknoteamount;
if (@banknoteamount <= 0) {
mes @npcname$;
mes "Please come back if you change your mind.";
close;
} else if (countitem(@banknoteid) < @banknoteamount) {
mes @npcname$;
mes "You dont have enough Bank Notes to complete this transaction.";
close;
}
next;
set @price,@banknoteprice*@banknoteamount;
delitem @banknoteid,@banknoteamount;
set Zeny,Zeny+@price;
mes @npcname$;
mes "Transaction complete! Here's your money.";
break;
case 2:
next;
mes @npcname$;
mes "Please put in the amount of Zeny you want to exchange.";
next;
input @zenyamount;
if (@zenyamount <= 0) {
mes @npcname$;
mes "Again, the minimum amount of zeny you can exchange is 1 Million Zeny.";
close;
} else if (@zenyamount > Zeny) {
mes @npcname$;
mes "I'm sorry but you lack Zeny to complete this transaction.";
close;
}
next;
set @noteamount,@zenyamount/@banknoteprice;
set @pricea,@noteamount*@banknoteprice;
set Zeny,Zeny-@pricea;
getitem @banknoteid,@noteamount;
mes @npcname$;
mes "Transaction complete! Here are your Bank Notes.";
break;
}
close;
end;
}
[/codeBOX]

[/font]

Edited by Arcenciel
Removed certain things, codebox'ed.
Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

I'm really confused on what you're asking... currently there is no limit to the # of bank notes you can exchange to zeny at a single time...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  201
  • Reputation:   47
  • Joined:  11/17/11
  • Last Seen:  

It might be that you cannot input a number over 10m or something? You should probably just change it (for players sake anyhow) to ask how many bank notes you want, then do the calculation for you. I'm really not sure that the number they put in 10,000,000 is the limit for an input, but who knows. Give it a try and let us know!

Edited by Truly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  116
  • Reputation:   4
  • Joined:  01/11/12
  • Last Seen:  

The problem is, with my script, it wont give you more than 10 Bank notes per transaction.

When changing Bank Notes to Zeny, there is no problem, I can change up to 2000 Bank Notes to Zeny, but it wont do the other way around.

For example, whenever I try to change 20 Million Zeny (or any amount more than 10 Million Zeny), it will only take 10 Million Zeny and give me 10 Bank Notes -- that is the problem. Can you tell me what have I done wrong with my script? :)

Note: This npc does not give any other problems like "it takes more than what it should take" or whatsoever, the only problem is that it gives me a limit of 10m for Zeny to Bank Note transaction.

It might be that you cannot input a number over 10m or something? You should probably just change it (for players sake anyhow) to ask how many bank notes you want, then do the calculation for you. I'm really not sure that the number they put in 10,000,000 is the limit for an input, but who knows. Give it a try and let us know!

Well if there really is a limit for number input then I better try what you have stated then. Because I think there is no easier way. /swt

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   13
  • Joined:  01/08/12
  • Last Seen:  

The input variable has a number limit so instead of entering the zeny why not make like "How many bank notes do you want" this way it will give u the desired result you looking for

 case 2:
next;
mes @npcname$;
mes "Please put in the amount of Notes you want.";
next;
input @noteamount;
if (@noteamount <= 0) {
 mes @npcname$;
 mes "Again, the minimum amount of notes you can exchange is 1.";
  close;
} else if (@noteamount*@banknoteprice > Zeny) {
 mes @npcname$;
 mes "I'm sorry but you lack Zeny to complete this transaction.";
 close;
}
next;
set @pricea,@noteamount*@banknoteprice;
set Zeny,Zeny-@pricea;
getitem @banknoteid,@noteamount;
mes @npcname$;
mes "Transaction complete! Here are your Bank Notes.";
break;

Try this and it would work fine

Edited by Vengeance
Link to comment
Share on other sites


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

(10 Million Zeny per transaction).

the input is limited here...

/conf/script_athena.conf

// Default value of the 'max' argument of the script command 'input'.
// When the 'max' argument isn't provided, this value is used instead.
// Defaults to INT_MAX.
//input_max_value: 2147483647
input_max_value: 10000000

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  116
  • Reputation:   4
  • Joined:  01/11/12
  • Last Seen:  

Thanks for the replies guys, and yeah Vengeance, I planned to change the script that way, that is the first thing I'm gonna do today (just woke up). :)

And thanks for the info Emistry, I'm, gonna take note of that one. /swt

Link to comment
Share on other sites


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

Please re-organize your script...

For Example :

mes "Again, the minimum amount of zeny you can exchange is 1 [/font]
[font=Arial, Verdana, Tahoma,]Million Zeny.";

it show the Formating code there...>.<

those newbie...or some member who just blindly copy the script and run in their server will caused error...then they will come spam you why error and etc...

and wrap your code using CODEBOX :) or upload as attachment....

then it would be better


Btw....some advise for your script..

the part for exchange Bank Note into Zeny..

add a zeny limit check before adding the zeny..

because sometime their zeny may reach or exceed the zeny limit when they change..

perhap it might caused some error...but for sure..they will "Wasted" their Bank Note due to Zeny Limit Reach

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

Edited the release as per Emistry's suggestions

Please re-organize your script...

For Example :

mes "Again, the minimum amount of zeny you can exchange is 1 [/font]
[font=Arial, Verdana, Tahoma,]Million Zeny.";

it show the Formating code there...>.<

those newbie...or some member who just blindly copy the script and run in their server will caused error...then they will come spam you why error and etc...

and wrap your code using CODEBOX :) or upload as attachment....

then it would be better

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  116
  • Reputation:   4
  • Joined:  01/11/12
  • Last Seen:  

btw, I have revised the script and also added a zeny limit check. I'm just gonna paste it here for people that might wanna use it.

//||------------------------------------------------------------------------------||
//||---------------------Simple Bank Note NPC ------------------------------------||
//||---------------------------by: Whathell---------------------------------------||
//||------------------------------------------------------------------------------||
//||------------------------------------------------------------------------------||

prontera,147,184,4 script Banker 833,{
//|=====================Settings==============================
set @npcname$,"^ff0000[banker]^000000";  //npc name
set @banknoteprice,1000000;   //price you want for each bank note
set @banknoteid,7922;	//the item id for your bank note
set @maxzeny,2000000000;   //put in the max zeny you have for your server
//|===========================================================
mes @npcname$;
mes "Hi "+ strcharinfo(0) +", I can change your bank notes into zeny, and vice versa.";
mes "Each bank note is worth 1 Million Zeny.";
next;
mes @npcname$;
mes "So tell me,what can I do for you?";
switch(select("Exchange Bank Notes to Zeny:Exchange Zeny to Bank Notes")) {
 case 1:
  next;
  mes @npcname$;
  mes "Please put in the amount of Bank Notes you want to exchange:";
next;
input @banknoteamount;
if (@banknoteamount <= 0) {
 mes @npcname$;
 mes "Please come back if you change your mind.";
 close;
} else if (countitem(@banknoteid) < @banknoteamount) {
 mes @npcname$;
 mes "You dont have enough Bank Notes to complete this
transaction.";
 close;
} else if ((@banknoteamount*@banknoteprice)+Zeny > @maxzeny) {
 mes @npcname$;
 mes "You cannot exchange this number of Bank Notes because you
will exceed the maximum amount of zeny you can hold.";
 close;
}
next;
set @price,@banknoteprice*@banknoteamount;
delitem @banknoteid,@banknoteamount;
set Zeny,Zeny+@price;
mes @npcname$;
mes "Transaction complete! Here's your money.";
break;
  case 2:
next;
mes @npcname$;
mes "Please put in the amount of Bank Notes you want.";
next;
input @noteamount;
if (@noteamount <= 0) {
   mes @npcname$;
  mes "Please come back if you change your mind.";
	close;
} else if (@noteamount*@banknoteprice > Zeny) {
   mes @npcname$;
   mes "I'm sorry but you lack Zeny to complete this transaction.";
   close;
}
next;
set @pricea,@noteamount*@banknoteprice;
set Zeny,Zeny-@pricea;
getitem @banknoteid,@noteamount;
mes @npcname$;
mes "Transaction complete! Here are your Bank Notes.";
break;
}
close;
end;
}

Edited by ToastOfDoom
codeboxed
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  1315
  • Reputation:   372
  • Joined:  12/10/11
  • Last Seen:  

btw, I have revised the script and also added a zeny limit check. I'm just gonna paste it here for people that might wanna use it.

Did you solve your issue?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  658
  • Reputation:   57
  • Joined:  11/20/11
  • Last Seen:  

Yes,I think that he solved it.

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