Jump to content
  • 0

problem with my credits npc


diehard

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  12/22/12
  • Last Seen:  

Check the warning below! I dont know how to fix that warning and debug.


[Warning]: script:op_2num: overflow detected op=C_MUL i1=300 i2=10000000
[Debug]: Source (NPC): Credits at prontera (138,183)

This is my script.


prontera,138,183,6 script Credits 899,{
// Your Server Max Zeny Amount
set .MaxZeny,2000000000;

// Coins Item ID and each Coins Costs
setarray .Coins[1],30005;
setarray .Zeny[1],10000000;

set @Menu$,"";
for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 ){
set @Menu$,@Menu$ + getitemname( .Coins[.@a] )+":";
}
while( 1 ){
mes "What do you want to do today?";
next;
switch( select( "Credits to Zeny:Zeny to Credits" ) ){
Case 1:
mes "Very well. Here is the list on how much each coin is worth:";
for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 ){
mes "^0000FF"+getitemname( .Coins[.@a] )+" ^FF0000"+.Zeny[.@a]+"^000000 Zeny.";
}
next;
set .@a,select( @Menu$ );
mes "Select the Amount of Credits you want to trade into Zeny.";
mes "You have "+countitem( .Coins[.@a] )+" "+getitemname( .Coins[.@a] )+".";
input @Amount,0,countitem( .Coins[.@a] );
if( @Amount < 1 ){
mes "You cancelled.";
}else if( ( Zeny + ( @Amount * .Zeny[.@a] ) ) > .MaxZeny ){
mes "You can hold this amount of Zeny.";
}else{
set Zeny,Zeny + ( @Amount * .Zeny[.@a] );
delitem .Coins[.@a],@Amount;
mes "Done, you have traded "+@Amount+" of "+getitemname(.Coins[.@a])+" into "+( @Amount * .Zeny[.@a] )+" Zeny.";
}
next;
break;
Case 2:
mes "Very well. Here is the list on how much each coin is worth:";
for( set .@a,1; .@a < getarraysize( .Coins ); set .@a,.@a+1 ){
mes "^0000FF"+getitemname( .Coins[.@a] )+" ^FF0000"+.Zeny[.@a]+"^000000 Zeny.";
}
next;
set .@a,select( @Menu$ );
mes "Select the Amount of Zeny you want to trade into "+getitemname( .Coins[.@a] )+".";
mes "You can get maximum of "+Zeny/.Zeny[.@a]+" "+getitemname( .Coins[.@a] )+".";
input @Amount,0,Zeny/.Zeny[.@a];
if( @Amount < 1 ){
mes "You cancelled.";
}else{
set Zeny,Zeny - ( @Amount * .Zeny[.@a] );
getitem .Coins[.@a],@Amount;
mes "Done, you have traded "+( @Amount * .Zeny[.@a] )+" Zeny into "+@Amount+" of "+getitemname(.Coins[.@a])+" .";
}
next;
break;
}
}
close;
}

payon,148,228,6 duplicate(Credits) Credits#0 899
morocc,170,84,2 duplicate(Credits) Credits#1 899

Edited by diehard
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  12/22/12
  • Last Seen:  

anyone can help me to this script? Thanks

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Check the warning below! I dont know how to fix that warning and debug.


[Warning]: script:op_2num: overflow detected op=C_MUL i1=300 i2=10000000
[Debug]: Source (NPC): Credits at prontera (138,183)

To prevent this overflow, I suggest to divide your check zeny when your trade Credits to Zeny.

replace

}else if( ( Zeny + ( @Amount * .Zeny[.@a] ) ) > .MaxZeny ){

to

else if( ( Zeny / 100 + ( .@Amount * .@Zeny[ .@a ] ) / 100 ) > .@MaxZeny / 100 ) {

prontera,138,183,6    script    Credits    899,{
// Your Server Max Zeny Amount
   set .@MaxZeny, 2000000000;

// Coins Item ID and each Coins Costs
   setarray .@Coins[ 1 ], 30005;
   setarray .@Zeny[ 1 ], 10000000;

   set .@Menu$,"";
   for( set .@a,1; .@a < getarraysize( .@Coins ); set .@a,.@a+1 )
       set .@Menu$,.@Menu$ + getitemname( .@Coins[ .@a ] )+":";

   while( 1 ) {
       mes "What do you want to do today?";
       next;
       switch( select( "Credits to Zeny:Zeny to Credits" ) ){
       case 1:
           mes "Very well. Here is the list on how much each coin is worth:";
           for( set .@a,1; .@a < getarraysize( .@Coins ); set .@a,.@a+1 ){
               mes "^0000FF"+getitemname( .@Coins[ .@a ] )+" ^FF0000"+.@Zeny[ .@a ]+"^000000 Zeny.";
           }
           next;
           set .@a, select( .@Menu$ );
           mes "Select the Amount of Credits you want to trade into Zeny.";
           mes "You have "+countitem( .@Coins[ .@a ] )+" "+getitemname( .@Coins[ .@a ] )+".";

           if( input( .@Amount, 1, countitem( .@Coins[ .@a ] ) ) != 0 )
               mes "You cancelled.";
           else if( ( Zeny / 100 + ( .@Amount * .@Zeny[ .@a ] ) / 100 ) > .@MaxZeny / 100 ) {
               mes "You can hold this amount of Zeny.";
           } else {
               set Zeny, Zeny + ( .@Amount * .@Zeny[ .@a ] );
               delitem .@Coins[ .@a ], .@Amount;
               mes "Done, you have traded "+.@Amount+" of "+getitemname( .@Coins[ .@a ] )+" into "+( .@Amount * .@Zeny[ .@a ] )+" Zeny.";
           }
           next;
           break;
       case 2:
           mes "Very well. Here is the list on how much each coin is worth:";
           for( set .@a,1; .@a < getarraysize( .@Coins ); set .@a,.@a+1 )
               mes "^0000FF"+getitemname( .@Coins[ .@a ] )+" ^FF0000"+.@Zeny[ .@a ]+"^000000 Zeny.";

           next;
           set .@a, select( .@Menu$ );
           mes "Select the Amount of Zeny you want to trade into "+getitemname( .@Coins[ .@a ] )+".";
           mes "You can get maximum of "+ ( Zeny/.@Zeny[ .@a ] ) +" "+getitemname( .@Coins[ .@a ] )+".";

           if( input( .@Amount, 1, Zeny / .@Zeny[ .@a ] ) != 0 )
               mes "You cancelled.";
           else {
               set Zeny,Zeny - ( .@Amount * .@Zeny[ .@a ] );
               getitem .@Coins[ .@a ],.@Amount;
               mes "Done, you have traded "+( .@Amount * .@Zeny[ .@a ] )+" Zeny into "+.@Amount+" of "+getitemname( .@Coins[ .@a ])+" .";
           }
           next;
           break;
       }
   }
   close;
}

payon,148,228,6    duplicate(Credits)    Credits#0    899
morocc,170,84,2    duplicate(Credits)    Credits#1    899

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  20
  • Reputation:   0
  • Joined:  12/22/12
  • Last Seen:  

...

 

Not working!

Edited by Capuche
Truncate long quote
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:  

uhm.....i was thinking to update that outdated script looooonnnnnnggggggg time ago..................

since i saw several topic that used the same scripts...i have updated it ......now... >.<

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  10/28/13
  • Last Seen:  

Mga ser pa help naman po newbie lang kase aq sa ganito .. pa script naman po ng Credits ID q ... Max zeny 2B ,,, Credits ID: 20038...

 

D ko po kase talaga makuha ng tama ayaw lumabas ng NPC... T_T plzzz



Some one help me to script my credits ID:20038.... plz i cant understand this... T_T ....

 

Can someone modify my script? Max Zeny = 2b and credits ID number : 20038? I don't know how to make it work. the npc is not showing

Edited by Patskie
Convert to english
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Please maintain english language in this section. If you can't express yourself then the international community are there to help you out. In this case, i replace your native language to english. Hope it wouldn't mind you

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