Jump to content
  • 0

Coin Exchanger With Amount


PapaZola

Question


  • Group:  Members
  • Topic Count:  318
  • Topics Per Day:  0.07
  • Content Count:  925
  • Reputation:   32
  • Joined:  12/05/11
  • Last Seen:  

hello this my coin exchanger but my problem

can i make exchange with input amount

if player put 60 heroic token player will receive 4 Sacred

 

 

goo3axbxh6.png

 

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

for Sacred:
input .@heroictoken;
if(countitem(HeroicTokenID)<.@heroictoken*15){
mes "Insufficient "+HeroicTokenID+"`s;
close;
}
getitem SacredTokenID,(.@heroictoken/15)
delitem HeroicTokenID,.@heroictoken

for Heroic:
input .@sacredtoken;
if(countitem(SacredTokenID)<.@sacredtoken/15){
mes "Insufficient "+SacredTokenID+"`s;
close;
}
getitem  HeroicTokenID,(.@sacredtoken*15)
delitem SacredTokenID,.@sacredtoken

This is the base script. Little modification will do. If you like me to customize it give me the whole script you are using. :)

Edited by Lil Troll
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  318
  • Topics Per Day:  0.07
  • Content Count:  925
  • Reputation:   32
  • Joined:  12/05/11
  • Last Seen:  

here my script please help sir its urgent

//================Token Exchanger====
maintown,78,121,6	script	Token Exchanger	713,{
    mes "I can change your [^0000FFScared Token^000000] to [^0000FFHeroic Quest Token^000000].";
    mes "1 Scared Token can be change for 15 Heroic Quest Token and Vise Versa";
    next;
    switch(select("Sacred to Heroic Exchange:Heroic to Sacred Exchange")) {
        case 1:
            mes "1 Sacret Token(20001) = 15 Heroic Quest Token";
            if (countitem(20001) < 1) { 
            mes "Sorry but you don't have enough tokens";
            close;
        } else {
            delitem 20001,1;
            getitem 20000,15;
            close;
        }
        end;
        case 2:
            mes "15 Heroic Quest Token =  1 Sacret Token(20001)";
            if (countitem(20000) < 15) { 
            mes "Sorry but you don't have enough tokens";
            close;
        } else {
            delitem 20000,15;
            getitem 20001,1;
            close;
        }
        end;
    }
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

//================Token Exchanger====
maintown,78,121,6    script    Token Exchanger    713,{
    mes "I can change your [^0000FFScared Token^000000] to [^0000FFHeroic Quest Token^000000].";
    mes "1 Scared Token can be change for 15 Heroic Quest Token and Vise Versa";
    next;
    switch(select("Sacred to Heroic Exchange:Heroic to Sacred Exchange"))
    {
        case 1:
            mes "1 Sacred Token(20001) = 15 Heroic Quest Token";
            mes "How many Sacred tokens do you wish to exchange?";
            input .@tokens;
            .@a = (.@tokens*15);
            if (countitem(20001) < .@tokens)
            {
                mes "Sorry but you don't have enough tokens";
                close;
            }
            else
            {
                delitem 20001,.@tokens;
                getitem 20000,.@a;
                close;
            }
            end;
            break;
        case 2:
            mes "15 Heroic Quest Token =  1 Sacred Token(20001)";\
            next;
            mes "How many sacred tokens do you want?";
            input .@tokens;
            .@a = (15*.@tokens);
            if (countitem(20000) < .@a)
            {
                mes "Sorry but you don't have enough tokens";
                close;
            }
            else
            {
                delitem 20000,.@a;
                getitem 20001,.@tokens;
                close;
            }
        end;
    }
}

 

Been a while since I last did scripting for RO, mainly been coding in PHP and Java. This should do the trick, though you could clean up the code essentially you have to write this all down just once, as both script parts do the same thing.

 

Cheers!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  318
  • Topics Per Day:  0.07
  • Content Count:  925
  • Reputation:   32
  • Joined:  12/05/11
  • Last Seen:  

got some error sir,im used eAthena

script error on npc/exchanger/spam.txt line 12
    parse_line: expect command, missing function name or calling undeclared function
     7 :     {
     8 :         case 1:
     9 :             mes "1 Sacred Token(20001) = 15 Heroic Quest Token";
    10 :             mes "How many Sacred tokens do you wish to exchange?";
    11 :             input .@tokens;
*   12 :             '.'@a = (.@tokens*15);
    13 :             if (countitem(20001) < .@tokens)
    14 :             {
    15 :                 mes "Sorry but you don't have enough tokens";
    16 :                 close;
    17 :             }

Edited by PapaZola
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:  

Change that line to :

set .@a, (.@tokens*15);

 

eAthena doesn't support direct variable declaration

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  318
  • Topics Per Day:  0.07
  • Content Count:  925
  • Reputation:   32
  • Joined:  12/05/11
  • Last Seen:  

still not working

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

Same error? Make sure you change the other one as well.

//================Token Exchanger====
maintown,78,121,6    script    Token Exchanger    713,{
    mes "I can change your [^0000FFScared Token^000000] to [^0000FFHeroic Quest Token^000000].";
    mes "1 Scared Token can be change for 15 Heroic Quest Token and Vise Versa";
    next;
    switch(select("Sacred to Heroic Exchange:Heroic to Sacred Exchange"))
    {
        case 1:
            mes "1 Sacred Token(20001) = 15 Heroic Quest Token";
            mes "How many Sacred tokens do you wish to exchange?";
            input .@tokens;
            set .@a, (.@tokens*15);
            if (countitem(20001) < .@tokens)
            {
                mes "Sorry but you don't have enough tokens";
                close;
            }
            else
            {
                delitem 20001,.@tokens;
                getitem 20000,.@a;
                close;
            }
            end;
            break;
        case 2:
            mes "15 Heroic Quest Token =  1 Sacred Token(20001)";\
            next;
            mes "How many sacred tokens do you want?";
            input .@tokens;
            set .@a, (15*.@tokens);
            if (countitem(20000) < .@a)
            {
                mes "Sorry but you don't have enough tokens";
                close;
            }
            else
            {
                delitem 20000,.@a;
                getitem 20001,.@tokens;
                close;
            }
        end;
    }
}
Edited by Jeroen
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

mes "15 Heroic Quest Token =  1 Sacred Token(20001)";\

There is an unknown \ at the end of this line :P

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