Simple point script

Page 3 of 3 FirstFirst 123
Results 31 to 38 of 38
  1. #31
    Acernis BLazeking558 is offline
    MemberRank
    May 2010 Join Date
    210Posts

    Re: Simple point script

    Quote Originally Posted by chunkarama View Post
    +1 for those multidimensional arrays! I can't tell you how many people to this day continue to have 1000 lines of if statements.. :(
    @chunkarama ME! huehue :D

  2. #32
    Valued Member SSFM is offline
    MemberRank
    Apr 2008 Join Date
    138Posts

    Re: Simple point script

    Thank you for doing this. I wish more Maple developers would pay attention to flexibility and ease-of-use in their code design.

  3. #33
    :l Cygnus is offline
    MemberRank
    Mar 2015 Join Date
    f425Location
    237Posts

    Re: Simple point script

    Some improvements to this; Add a check to status == 3
    Code:
    if (cm.canHold(ITEMS[STORAGE1][STORAGE2][0])) {
                cm.getPlayer().gainEventPoints(-ITEMS[STORAGE1][STORAGE2][1]);
                cm.gainItem(ITEMS[STORAGE1][STORAGE2][0], 1);
                cm.sendOk("Enjoy your #i"+ITEMS[STORAGE1][STORAGE2][0]+"# #t"+ITEMS[STORAGE1][STORAGE2][0]+"##k!");
    } else {
    cm.sendOk("It seems you don't have enough room in your inventory for #t"+ITEMS[STORAGE1][STORAGE2][0]+"#k.");
    }
    And matter of opinion, but adding a message if the user selects no in status == 2
    Code:
    if (status == 2 && mode == 0) {
    cm.sendOk("Something");
    cm.dispose();
    }
    Also, making it a three-dimensional array allowing quantities as well would've been nice, but this is a great foundation~
    Good job :)
    Last edited by Cygnus; 23-06-15 at 04:09 AM.

  4. #34
    Nae-un <33 Thane Krios is offline
    MemberRank
    Jun 2012 Join Date
    CaliforniaLocation
    568Posts

    Re: Simple point script

    Quote Originally Posted by chunkarama View Post
    Nice one, that's an even shorter return line :)



    I reduce lines because in my opinion (it's just the way I program) I would prefer to have shorter code. If i'm going to be returning a single int or string, I'm going to use ternary because I can fit it all into one line rather than using if-else-if-else-if-else ... However, yes, if I can use an array like Fraysa had did that would end up being even shorter (again, to me the shorter the better). I also prefer to use ternary within all my NPC's actions whenever I can (instead of using if). ex. (m == 1 ? cm.warp(1, 0) : cm.killPlayer()); and so on. It really just depends on the person I guess.
    Make sure it doesn't conflict with the ability to run code. Now I know there shouldn't be performance issues with your code if in the event it was given bigger values (maybe the ternary would be really annoying to write, which in that case you would use an array instead), but shorter code doesn't always equal efficient code.

  5. #35
    unknowndog NmZero is offline
    MemberRank
    Jul 2012 Join Date
    unknowndogLocation
    202Posts

    Re: Simple point script

    Quote Originally Posted by Cygnus View Post
    Some improvements to this; Add a check to status == 3
    Code:
    if (cm.canHold(ITEMS[STORAGE1][STORAGE2][0])) {
                cm.getPlayer().gainEventPoints(-ITEMS[STORAGE1][STORAGE2][1]);
                cm.gainItem(ITEMS[STORAGE1][STORAGE2][0], 1);
                cm.sendOk("Enjoy your #i"+ITEMS[STORAGE1][STORAGE2][0]+"# #t"+ITEMS[STORAGE1][STORAGE2][0]+"##k!");
    } else {
    cm.sendOk("It seems you don't have enough room in your inventory for #t"+ITEMS[STORAGE1][STORAGE2][0]+"#k.");
    }
    Also, making it a three-dimensional array allowing quantities as well would've been nice, but this is a great foundation~
    Good job :)
    sorry, i dont really get what you meant by 'add a check to status == 3'
    also, about the quantities, i made this script with the idea of selling equips, a friend requested it. So i didnt really think of the quantities, but its a nice idea, i might add it if somebody needs it

  6. #36
    :l Cygnus is offline
    MemberRank
    Mar 2015 Join Date
    f425Location
    237Posts

    Re: Simple point script

    Quote Originally Posted by NmZero View Post
    sorry, i dont really get what you meant by 'add a check to status == 3'
    also, about the quantities, i made this script with the idea of selling equips, a friend requested it. So i didnt really think of the quantities, but its a nice idea, i might add it if somebody needs it
    What I mean is to add a check to confirm the user can hold the item previous to giving it to them. Without the check, if you try purchasing an item with a full inventory; you'd lose your points without gaining the item.

  7. #37
    Account Upgraded | Title Enabled! Syre is offline
    MemberRank
    Jan 2013 Join Date
    700Posts

    Re: Simple point script

    I will say, despite the fact that I highly doubt you are who your name (I guess indirectly?) implies you're taking the reputation of...
    Your scripting is extremely identical.


    But, regardless, good release. This should help those less fortunate. (I know, I'm really late on this)

  8. #38
    jRvdJxwvjhs Linkerzz is offline
    MemberRank
    Nov 2008 Join Date
    NorwayLocation
    345Posts

    Re: Simple point script

    Thank you for this.



Page 3 of 3 FirstFirst 123

Advertisement