Jump to content

Hyroshima

Members
  • Posts

    189
  • Joined

  • Last visited

  • Days Won

    24

Community Answers

  1. Hyroshima's post in Script to Count cards adquired was marked as the answer   
    Let's use in here script_commands.txt example: https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L9179
    you use it like this:
    totalCards = query_sql("SELECT COUNT(*) FROM player_cards WHERE account_id = '" + getcharid(3) + "'"); basically totalCards will receive 1 if the query_sql is executed successfully or 0 in case of failure, now the values to which you are doing the SELECT need a scope in which they will always be an array of values, in your case as a sum of all the values in the table referring to the account id, so the array will only have one index with the result, so you would have to do it like this:
    prontera,140,174,4 script Personal storage2#prt 113,{ OnInit: // Query of obtained cards query_sql("SELECT COUNT(*) FROM player_cards WHERE account_id = '" + getcharid(3) + "'",.@totalCards); // totalCards = query_sql("SELECT COUNT(card_id) FROM player_cards WHERE account_id = '" + getcharid(3) + "'"); mes "[Card Album]"; mes "Here, let me open"; mes "your Card record."; //Ex1 mes "You have collected " + .@totalCards + " cards out of 1009."; //Ex2 mes "You have collected " + .@totalCards[0] + " cards out of 1009."; mes "Thank you for using"; mes "the Kafra Service."; close; } Remembering that you cannot use the OnInit label and then use commands that are common to rid (player) without attaching rid (player) as in the case of the "mes","getcharid(3)" and "close" commands, this will cause an error on the stating emulator  that there is no rid attached, I hope you understand what I tried to explain 🙂
  2. Hyroshima's post in Script not work and got error with buildin_rand was marked as the answer   
    Search for this function:
    function gviewid { set .@n,getarraysize(.viewid); while(1) { set .@zt,.@zt+1; if(.@zt&13)sleep2(1); if(set(.@u,.viewid[set(.@t,rand(.@n))])) break; } for(;.@t<.@n;set .@t,.@t+1) set .viewid[.@t],.viewid[.@t+1]; return .@u; }  
    and replace with this:
    function gviewid { set .@n,getarraysize(.viewid); if(.@n<=1) set .@rnd,0; else set .@rnd,rand(.@n); //dispbottom "."+getarraysize(.viewid)+""; while(1) { set .@zt,.@zt+1; if(.@zt&13)sleep2(1); if(set(.@u,.viewid[set(.@t,.@rnd)])) break; } for(;.@t<.@n;set .@t,.@t+1) set .viewid[.@t],.viewid[.@t+1]; return .@u; }  
     
  3. Hyroshima's post in Check if the player is on a certain map was marked as the answer   
    use this:
    if(strcharinfo(3) == "prt_fild08") end;  
  4. Hyroshima's post in Rewards system giving error was marked as the answer   
    replace this:
    dispbottom "You've spent one minute in WoE and gained a WoE point." dispbottom "Total points earned: +woepoints; that is why:
    dispbottom "You've spent one minute in WoE and gained a WoE point."; dispbottom "Total points earned: "+woepoints;
     
  5. Hyroshima's post in NPC BMP Cutins was marked as the answer   
    \data\luafiles514\lua files\signboardlist.lub
    look for where and map
  6. Hyroshima's post in Compiling error: C2466: cannot allocate an array of constant size 0 was marked as the answer   
    solved by downloading revision 16311 https://github.com/rathena/rathena/commit/390eb9772ad001c48e4ebbb06969b4a0b885b21d
×
×
  • Create New...