Jump to content

Songbird

Members
  • Posts

    19
  • Joined

  • Last visited

Community Answers

  1. Songbird's post in 1 CLICK NPC BUY was marked as the answer   
    Try this script I made (Is not tested so it could not work):
    prontera,150,150,7 script Quick Sell NPC#QSN1 815,{ goto OnClick; end; OnInit: // = CONFIGURE YOUR NPC HERE ========== // Enter the Item ID the NPC will buy .buyItemID = 999; // If 1, the npc will buy all the item stack at once .buyAllItems = 0; // If .buyAllItems is 0, NPC will buy the quantity set here .buyQuantity = 1; // Show deal message: 1 or not: 0 .showDealMessage = 1; // ==================================== waitingroom "B>" + getitemname(.buyItemID),0; end; OnClick: if (countitem(.buyItemID)) { .@itemPrice = getiteminfo(.buyItemID,1); if (.buyAllItems) { Zeny += .@itemPrice * countitem(.buyItemID); .@zenyEarned = .@itemPrice * countitem(.buyItemID); if (.showDealMessage) dispbottom "You sold " + countitem(.buyItemID) + " " + getitemname(.buyItemID) + " for " + callfunc("F_InsertComma",.@zenyEarned) + " Zeny."; delitem .buyItemID,countitem(.buyItemID); } else { if (.buyQuantity > 1 && countitem(.buyItemID) < .buyQuantity) { Zeny += .@itemPrice * countitem(.buyItemID); .@zenyEarned = .@itemPrice * countitem(.buyItemID); if (.showDealMessage) dispbottom "You sold " + countitem(.buyItemID) + " " + getitemname(.buyItemID) + " for " + callfunc("F_InsertComma",.@zenyEarned) + " Zeny."; delitem .buyItemID,countitem(.buyItemID); } Zeny += .@itemPrice * .buyQuantity; .@zenyEarned = .@itemPrice * .buyQuantity; if (.showDealMessage) dispbottom "You sold " + .buyQuantity + " " + getitemname(.buyItemID) + " for " + callfunc("F_InsertComma",.@zenyEarned) + " Zeny."; delitem .buyItemID,.buyQuantity; } } else { dispbottom "Not enough items to sell."; } end; }  
  2. Songbird's post in How to check if there is a special character in input was marked as the answer   
    Try using
    *preg_match(<regular expression pattern>,<string>{,<offset>}) Searches a string for a match to the regular expression provided. The offset parameter indicates the index of the string to start searching. Returns offsets to captured substrings, or 0 if no match is found. This command is only available if the server is compiled with the regular expressions library enabled.  
    Something like this could work:
    if (preg_match("^[a-zA-Z0-9]+$",.@yourString$) { // This means it found a coincidence, meaning that no symbols where fund } else { // No matches, symbols where found }  
×
×
  • Create New...