Jump to content

Arduino

Members
  • Content Count

    48
  • Joined

  • Last visited


Reputation Activity

  1. Upvote
    Arduino got a reaction from kalabasa in Random Enchant   
    Im not really sure what you want, but i understood that you wanted the enchantment to be random instead of it to be selected in a list.
    I had made here a modification on line 47 making it random instead of selecting it from the list.
    mes .n$; mes "Hello, "+strcharinfo(0)+"!"; mes "If you like I can enchant your costume equipment with any enchantment I have in store"; mes ( (.exchange_cost[0] > 0)?"in exchange for "+.enchant_cost[1]+"x "+getitemname(.enchant_cost[0]):"for free")+"."; mes "I can also reset an Enchantment "+ ((.enchant_reset[0] > 0)?", but I require "+.enchant_reset[1]+"x "+getitemname(.enchant_reset[0]):"for free")+"."; next; switch(select("- Enchant Costumes:- Reset Enchantment:- Nevermind")) { case 1: mes .n$; mes "Please select the Costume you want me to enchant:"; for ( set .@s,0; .@s < getarraysize(.enchant_slot); set .@s,.@s + 1) { switch(.enchant_slot[.@s]) { case EQI_COSTUME_HEAD_TOP: set .@c_slot$,"Top Headgear"; break; case EQI_COSTUME_HEAD_MID: set .@c_slot$,"Mid Headgear"; break; case EQI_COSTUME_HEAD_LOW: set .@c_slot$,"Low Headgear"; break; case EQI_COSTUME_GARMENT: set .@c_slot$,"Garment"; break; case EQI_SHADOW_ARMOR: set .@c_slot$,"Armor"; break; case EQI_SHADOW_WEAPON: set .@c_slot$,"Weapon"; break; case EQI_SHADOW_SHIELD: set .@c_slot$,"Shield"; break; case EQI_SHADOW_SHOES: set .@c_slot$,"Shoes"; break; case EQI_SHADOW_ACC_R: set .@c_slot$,"Accessory Right"; break; case EQI_SHADOW_ACC_L: set .@c_slot$,"Accessory Left"; break; } set .@c_m$,.@c_m$ + ((getequipid(.enchant_slot[.@s]) != -1)?.@c_slot$ + " - "+getitemname(getequipid(.enchant_slot[.@s])):"") + ( (.enchant_slot[.@s+1] != 0)?":":""); } set .@c_m$,.@c_m$ + ":- Cancel"; set .@c,select(.@c_m$); if(.@c >= getarraysize(.enchant_slot)) close; set .@part,.enchant_slot[.@c-1]; next; mes .n$; if(getequipid(.@part) == -1) { mes "It looks like you don't have any costume equipped on there."; close; } set .@hg,getequipid(.@part); // Saving Item ID set .@ref,getequiprefinerycnt(.@part); // Saving Refine Level, if there is one set .@card1,getequipcardid(.@part,0); // Save Item ID of Card Slot 1 mes "Selected Costume: "+getitemname(getequipid(.@part)); if(getequipcardid(.@part,3) != 0) { mes "But it looks like you already have an enchantment in this costume."; close; } mes "Now please select the Enchantment:"; next; set .@rune,rand(0, getarraysize(.enchant_id) - 1); mes .n$; mes "Selected Enchantment: "+getitemname(.enchant_id[.@rune]); if(.enchant_cost[0] > 0 && countitem(.enchant_cost[0]) < .enchant_cost[1]) { mes "But it looks like you don't have enough "+getitemname(.enchant_cost[0])+"!"; close; } mes "Proceed?"; if(select("- Yes:- No") - 1) close; next; if(.enchant_cost[0] > 0) delitem .enchant_cost[0],.enchant_cost[1]; delequip .@part; getitem2 .@hg,1,1,.@ref,0,.@card1,0,0,.enchant_id[.@rune]; equip .@hg; mes .n$; mes "The enchantment was a success."; mes "See ya next time."; enable_items; break; case 2: mes .n$; mes "Please select the Costume you want me to reset the enchantment!"; for ( set .@s,0; .@s < getarraysize(.enchant_slot); set .@s,.@s + 1) { switch(.enchant_slot[.@s]) { case EQI_COSTUME_HEAD_TOP: set .@c_slot$,"Top Headgear"; break; case EQI_COSTUME_HEAD_MID: set .@c_slot$,"Mid Headgear"; break; case EQI_COSTUME_HEAD_LOW: set .@c_slot$,"Low Headgear"; break; case EQI_COSTUME_GARMENT: set .@c_slot$,"Garment"; break; case EQI_SHADOW_ARMOR: set .@c_slot$,"Armor"; break; case EQI_SHADOW_WEAPON: set .@c_slot$,"Weapon"; break; case EQI_SHADOW_SHIELD: set .@c_slot$,"Shield"; break; case EQI_SHADOW_SHOES: set .@c_slot$,"Shoes"; break; case EQI_SHADOW_ACC_R: set .@c_slot$,"Accessory Right"; break; case EQI_SHADOW_ACC_L: set .@c_slot$,"Accessory Left"; break; } set .@c_m$,.@c_m$ + ((getequipid(.enchant_slot[.@s]) != -1)?.@c_slot$ + " - "+getitemname(getequipid(.enchant_slot[.@s])):"") + ( (.enchant_slot[.@s+1] != 0)?":":""); } set .@c_m$,.@c_m$ + ":- Cancel"; set .@c,select(.@c_m$); if(.@c >= getarraysize(.enchant_slot)) close; set .@part,.enchant_slot[.@c-1]; next; mes .n$; if(getequipcardid(.@part,3) == 0) { mes "It looks like you don't have any enchantment in this costume."; close; } set .@hg,getequipid(.@part); // Saving Item ID set .@ref,getequiprefinerycnt(.@part); // Saving Refine Level, if there is one set .@card1,getequipcardid(.@part,0); // Save Item ID of Card Slot 1 mes "Selected Costume: "+getitemname(getequipid(.@part)); if(.enchant_reset[0] > 0 && countitem(.enchant_reset[0]) < .enchant_reset[1]) { mes "But you don't have the required Items to reset the enchantment!"; close; } mes "Proceed?"; if(select("- Yes:- No") - 1) close; next; if(.enchant_reset[0]) delitem .enchant_reset[0],.enchant_reset[1]; delequip .@part; getitem2 .@hg,1,1,.@ref,0,.@card1,0,0,0; equip .@hg; mes .n$; mes "The enchantment has been reseted."; mes "See ya next time."; break; case 3: break; } end; OnInit: set .n$,"[Costume Enchanter]"; // Enter here every Costume Slot, which you want to be enchantable // Valid Entries: // - EQI_COSTUME_HEAD_TOP // - EQI_COSTUME_HEAD_MID // - EQI_COSTUME_HEAD_LOW // - EQI_COSTUME_GARMENT // - EQI_SHADOW_ARMOR // - EQI_SHADOW_WEAPON // - EQI_SHADOW_SHIELD // - EQI_SHADOW_SHOES // - EQI_SHADOW_ACC_R // - EQI_SHADOW_ACC_L setarray .enchant_slot[0],EQI_COSTUME_HEAD_TOP,EQI_COSTUME_HEAD_MID,EQI_COSTUME_HEAD_LOW; // Enchantment ID's setarray .enchant_id[0],6636,6637,6638,6639,6640,6641; // Price for enchanting: // To disable the price, put 0 as values setarray .enchant_cost[0],501,10; // Item ID,Amount // Price for reseting: // To disable the price, put 0 as values setarray .enchant_reset[0],501,10; // Item ID,Amount end; } If you can be more specific of what do you need maybe i can help you further. If you dont know how to say it you can use the help of google translate
  2. Like
    Arduino reacted to Ai4rei in Two Images Cutin AT ONCE   
    If done on the server-side, you'll have constant flood of network traffic; then imagine if 100 people talk to such an NPC.If done on either side, you'll most likely have a great deal of flicker; players with epilepsy won't be very much amused.
  3. Upvote
    Arduino got a reaction from utofaery in How to make countitem not counting equip equipments   
    With getinventorylist you can get the list of items.
     
    It's not possible to delete an item from the inventory only. Delitem does not support arguments for inventory index, even though it should. If you want a source mod for it I can help.
     
    You can do something like:
    getinventorylist; for(.@i=0; .@i < @inventorylist_count; .@i++){ if(@inventorylist_equip[.@i] == 0) .@inventlist++; //Do the thing that you want to do here with the item, .@i is the index of the item. }  
      with this, you are counting all the items in the inventory of the character that are not being used.
     
    Sorry if I replied late to this post, but i wanted to help.
     
    PD:
    Here are the variables that you can retrieve from getinventorylist:
     
    @inventorylist_id[]        - array of item ids. @inventorylist_amount[]    - their corresponding item amounts. @inventorylist_equip[]     - will return the slot the item is equipped on, if at all. @inventorylist_refine[]    - for how much it is refined. @inventorylist_identify[]  - whether it is identified. @inventorylist_attribute[] - whether it is broken. @inventorylist_card1[]     - These four arrays contain card data for the @inventorylist_card2[]       items. These data slots are also used to store @inventorylist_card3[]       names inscribed on the items, so you can @inventorylist_card4[]       explicitly check if the character owns an item                              made by a specific craftsman. @inventorylist_expire[]    - expire time (Unix time stamp). 0 means never                               expires. @inventorylist_bound       - whether it is an account bounded item or not. @inventorylist_count       - the number of items in these lists.    
  4. Upvote
    Arduino reacted to Habilis in How to create server status script for website php (non flux cp)   
    Habilis is all about CyberSecurity
    SO, here is an answer of a Hukker
    Create a SQLView in teh Database 
    https://www.w3schools.com/sql/sql_view.asp
    example 
    CREATE VIEW vw_ServerStats AS SELECT   ... FROM users WHERE ... LEFT JOIN ...   ON ... 2 - Create a SQL user  herc_Viewer
    With the grant to select ONLY on vw_ServerStats
    That way if an Evil Hukker such as Habilis uploads a WebShell to your shitkoded super sophisticated website
    and sees your connections string for user herc_Viewer and his password. 
    Habilis will not be able (CREATE, EDIT, DELETE) users
    Habilis will not be able to CREATE mvp cards and sell them for real money (Habilis's favorite)
    Habilis will not be able to SELECT user info such as Emails and passwords
    Only thing Habilis will be able to do is to SELECT info already publically available on your website.
     
    Beware of Hukkers, and don't forget to download your internet anonymity!
     
     
  5. Upvote
    Arduino got a reaction from Lecter in [Solved] Closed connection before login?   
    That's the problem, you need to put the IP address of the server, because the login server its redirecting your client to "127.0.0.1" char-server (your own machine ip).
    Try changing those values.
  6. Upvote
    Arduino got a reaction from Apacman in Búsqueda de Hosting (Latinoamérica y Sur)   
    Saludos.
    La mejor opción por mi parte, siempre serán los servidores hosting tradicionales, tales como ovh, contaboo, digital ocean, etc. Ya que todos los otros que son específicamente para Ragnarok siempre escucharas que son una insulto generico...- y la razón de ello es que para cobrar no tienen problema, pero cuando necesitas soporte, no aparecerán más.
    Yo en lo personal, te recomiendo cualquier vps de OVH, es un buen servicio con buena latencia y características (quiza poco espacio de almacenamiento, pero eso se puede expandir por unos dolares más).
    Lo que te interesara luego, es ponerle un SO de linux, siendo ubuntu una de las mejores opciones, sobre todo para la gente con menos conocimientos en este tipo de SO.
    Luego, si sabes ingles vas a querer seguir esta guía para poder instalar todo, quedando una instalación fresca de hercules!
    espero haber sido de ayuda, y cualquier duda solo dímela!
  7. Upvote
    Arduino got a reaction from meko in Manipulate Mob   
    Hi!
    I recommend you to see the doc/script_commands.txt file and search for unit_walk, unit_attack, unit_emote, etc. Those are the commands that you are looking for and in the same documentation file are examples of how to use them!
  8. Upvote
    Arduino reacted to Temtaime in New life for RO   
    Hello !
    I want to remake the interface, so is there someone who can draw and is interested in it ? We can make brand new, better interface.
    Write me.
  9. Upvote
    Arduino reacted to Temtaime in New life for RO   
    Hello guys !
    I'm sorry for such a delay, but i have some troubles IRL, and while i'm the only one who develops this client, there was no news.
    Æsir made a big step, many basic features are now accessible. It's not so much comparing with korean client, but it's a good start. With time, features will multiply.
    You can download and try it right here.

  10. Upvote
    Arduino reacted to Shiro in [Showcase] Patcher Theme   
    So... I'm a beginner at graphics designing. Please let me know what you think
    I used Hyvraine's designs as references
    also... if someone can code this please help me. message me here!
     

  11. Upvote
    Arduino reacted to smiths12 in Neon Bat   
    View File Neon Bat
    Another monster from maplestory. Neon Bat.
    Submitter smiths12 Submitted 07/20/17 Category Sprites & Palettes  
  12. Upvote
    Arduino got a reaction from meko in Determine when a mob's died   
    As meko is correct, this script command wouldnt be more appropiate?
    areamobuseskill("<map name>", <x>, <y>, <range>, <mob id>, <skill id>, <skill level>, <cast time>, <cancelable>, <emotion>, <target type>) *areamobuseskill("<map name>", <x>, <y>, <range>, <mob id>, "<skill name>", <skill level>, <cast time>, <cancelable>, <emotion>, <target type>) This command will make all monsters of the specified mob ID in the specified area use the specified skill. Map name, x, and y define the center of the area, which extending <range> cells in each direction (ex: a range of 3 would create a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in milliseconds (1000 = 1 second), and the rest should be self-explanatory. <target type> can be: 0 = self 1 = the mob's current target 2 = the mob's master 3 = random target Example: // spawn 1 Shining Plant in the 5x5 area centered on (155,188) areamonster("prontera", 153, 186, 157, 190, "Shining Plant", SHINING_PLANT, 1); // make the plant cast level 10 Cold Bolt on a random target areamobuseskill("prontera", 155, 188, 2, SHINING_PLANT, MG_COLDBOLT, 10, 3000, 1, e_gg, 3)  
  13. Upvote
    Arduino reacted to kami-shi in 34 Kamishi's Clothes & Hair Palettes (Updated 2018!!)   
    View File 34 Kamishi's Clothes & Hair Palettes (Updated 2018!!)
    Support All classes including new Mounts, Oboro, Kagerou, Rebellion and 3rd Costumes ! Yay ! =3
    The palettes are ranged from 0 to 35.
    For this pack to look the best you must use my corrected classes sprites and Haziel's 3rd Costumes sprites
    These palettes are from my big 700 palette pack !
    If you want more, you may contact me here :  Paletting services (More than 700 Palettes, Races and Colors! :3).
    Thank you ! >o<
    Submitter kami-shi Submitted 07/12/17 Category Sprites & Palettes  
  14. Upvote
    Arduino reacted to Habilis in [Dev's Diary] Minimal $ Ragnarok online server & comunity   
    Day 9 : Didn't want to come back to BeyondCompare....
    So, I don't want to come back to BeyondCompare and configuring 1000 of files to the episode 11.1, I was desperateley browsing downloads section for at least something more exciting to do!!
    Anything... As I've done pretty much everything....
    And one more thing cought my eye. DailyRewards!!! 
    Well my server already have that, but very basic one. Why not make it golden?
    so I took this and a few of similar releases
    and did this
    day1
    day 2
    well you get the idea...
     
    And, Yes you rad it correctly "A little something to make a player's day with us even better"
    And no, it is not an invitation to create 500 characters and farm daily rewards 
    As these items are not actually real items
    But an Event version (same features but....)
    - Not Kafra/Guild storable
    - Not Tradable / Vendable / NPC sellable
    - Not droppable
     
    Basically an item given to one character to make his/her day even more fun...
    Applying Only Best Practices since 2017...  (C)
  15. Upvote
    Arduino reacted to Temtaime in New life for RO   
    Allez vous faire foutre tous ceux qui m'disent que c'est mort.
    Are you really think that it's so easy to write a game from scratch on one's own ?
    I am working and i have my life, and with all those things i am continuing write this client.
    There will be first public beta release in 1-2 weeks with new features, of course.
  16. Upvote
    Arduino reacted to Habilis in [Dev's Diary] Minimal $ Ragnarok online server & comunity   
    UPDATE: Now That I have the Logo
    I can start doing stuff with it
    Like
    Creating a login screen
    and
    Making a screenshot watermark (Thingy that appears in the bottom right corner on screenshots)

     
    Nextup, some loading screens.....
  17. Upvote
    Arduino reacted to Habilis in [Dev's Diary] Minimal $ Ragnarok online server & comunity   
    Day ... Hell if I know:
     
    Using the theme I had
    http://webapplayers.com/homer_admin-v2.0/landing_page.html
     
    I designed the home page (needs some more work like for timer and other) 
    But this how I wanted my home page to look.
    It's completely adaptive.
    And I finally put to use my personally developed Ragnarok captcha,
    at the register section.
    DISCLAIMER : 
    NOT AN ADVERTISMENT
    Server name HabilisRO is fictional, made up for the purpose of this Dev's Diary. All matches with the existing servers are a coincidence. 

     
    Ow and should I mention the Special Thanks ?
    Special thanks to Daifuku for providing free graphical content.
     
    There will be a link to her profile...
     
     
  18. Upvote
    Arduino reacted to Temtaime in New life for RO   
    A client now has a name - Æsir !
    You can support development on the patreon. More support, less freelance i do
    https://www.patreon.com/temtaime
    First public build will be available soon.
  19. Upvote
    Arduino got a reaction from ShadowKing in [Solved] Closed connection before login?   
    That's the problem, you need to put the IP address of the server, because the login server its redirecting your client to "127.0.0.1" char-server (your own machine ip).
    Try changing those values.
  20. Upvote
    Arduino reacted to Khazou in getmapusers - More options   
    You can use this
     
    *getunits(<type>, <variable>, <limit>, "<map>"{, <x1>, <y1>, <x2>, <y2>}) This function searches a whole map or area for units and adds their GID to the provided <variable> array. It filters units by <type> and stops searching after <limit> units have been found. Set <limit> to false (0) if you wish to disable the limit altogether. Type is the type of unit to search for: BL_PC - Character object BL_MOB - Monster object BL_PET - Pet object BL_HOM - Homunculus object BL_MER - Mercenary object BL_IEM - Item object (item drops) BL_SKILL - Skill object (skill fx & sfx) BL_NPC - NPC object BL_CHAT - Chat object BL_ELEM - Elemental object BL_CHAR - Shorthand for (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM) BL_ALL - Any kind of object ** Do NOT use UNITTYPE_ constants here, they have different values. Example: .@count = getunits((BL_PC | BL_NPC), .@units, false, "prontera"); The above example would search the map "prontera" for all PC and NPC units and add them to the .@units array, while setting .@count to the amount of units added to the array (useful in for() loops).
  21. Upvote
    Arduino reacted to Sephus in Introducing the Item Options System   
    Introducing the Item Options System!
     

     
    Commit
    https://github.com/HerculesWS/Hercules/commit/974222a8d3f189083205bf5d330de04a43226ad3
     
    Feature Information
    The Item Option System is a feature that was implemented in 2015-02-26 clients, allowing equipments to have up to 5 additional effects similar to cards or enchants. Each equipment is capable of having 5 information bars above the card slot/enchant bar that describes the effect of the option it is infused with.
     
    New Script Commands (The following snippet is available in doc/script_commands.txt.)
    *getequipisenableopt(<equipment slot>) This function checks if the equipped item allows the use of bonus options. Returns 1 if allowed, 0 if not. --------------------------------------- *getequippedoptioninfo(<info_type>); This function is to be used with the scripts of contents listed in db/item_options.conf only. Returns the value of the current equipment being parsed. If the equip was not found or the type is invalid, -1 is returned. --------------------------------------- *getequipoptioninfo(<equip_index>,<slot>,<type>); Gets the option information of an equipment. <equipment_index> For a list of equipment indexes see getequipid(). <option_slot> can range from 1 to MAX_ITEM_OPTIONS <type> can be IT_OPT_INDEX (the ID of the option bonus, @see "Id" or "Name" in db/item_options.conf) or IT_OPT_VALUE (the value of the bonus script of the equipment, @see "Script" in db_item_options.conf). returns the value of the slot if exists or -1 for invalid slot, type or slots. --------------------------------------- *setequipoption(<equip_index>,<slot>,<opt_index>,<value>); Set an equipment's option index or value for the specified option slot. <equipment_index> For a list of equipment indexes see getequipid(). <option_slot> can range from 1 to MAX_ITEM_OPTIONS <type> can be IT_OPT_INDEX (the ID of the option bonus, @see "Id" or "Name" in db/item_options.conf) <value> The value of the type to be set. returns 0 if value couldn't be set, 1 on success.  
     
    Release Notes
    This system allows the infusing of equipments with bonus item options. This feature is constrained to clients of packet versions greater than or equal to 20150226. Item Options and their effects are defined server-side in db/item_options.conf and client side in data/luafiles514/lua files/datainfo/addrandomoptionnametable.lub The ID of the option must tally with the correct index of the description provided in the client side file. IT_OPT_* keys and MAX_ITEM_OPTIONS macro are also exported from the source as constants. If you wish to disable item options for certain (equipment) items, an additional flag `disable_options` has been added to the item sql tables, and as `DisableOptions: true/false (boolean, defaults to false !!for equipments only!!)` to the item_db.conf files. Documentation is provided for script commands. If upgrading, don't forget to run the sql upgrade files!
    Credits
    A big thanks to all the reviewers that helped make the code closer to perfection. -
    Emistry, dastgir, MishimaHaruna, Jedzkie, Ridley8819, Asheraf, 4144.
     
    Style and Script Fixes by Asheraf (https://github.com/Asheraf)
    Initial design Idea in rAthena commit.
  22. Upvote
    Arduino got a reaction from tedexx in showevent() additional icons   
    Hey! this is a client related, but to add more icons you have to add it in the data and add the info of the new icon in db/constants.conf below comment__: "questinfo"
  23. Upvote
    Arduino got a reaction from tedexx in OnPCUseItem, OnPCGetHit, OnPCHit   
    yes, they are completely viable and are not to hard to implement.
    If i have time i will make a plugin for this events!
  24. Upvote
    Arduino reacted to tedexx in Player walking when interacting with NPC or Skill   
    I'm having an interaction bug that is not default of RO and pretty annoying. It would be impossible to run a production server with that. I think its a core problem with Herc.
     
    - When clicking a NPC that have no mes() function, the npc click event is triggered but the player also walks to the mouse position.
    - When using skill (only one click): The skill is evoked but the player also walks to the mouse position
     
    How can this be fixed?
     
     
    NPC interaction demo (GIF):

     
    NPC code: (npctalk2 is only a example, it could be anything besides mes() and it would still happen)
    prt_fild01,280,144,5 script empty_npc 4W_SAILOR,{ npctalk2("why are you walking when clicking me?"); end; }  
    Skill interaction demo (GIF):

  25. Upvote
    Arduino reacted to Haru in About Code Review and Why You'd Want Your Code to Be Reviewed   
    About Code Review and Why You'd Want Your Code to Be Reviewed
     
    Hello, fellow developers and code contributors!
    As you certainly know, years ago, Hercules adopted a workflow based on pull requests, that includes code review as one of the necessary steps before any new piece of code makes it into the master branch of the repository.
    While being an uncommon and somewhat controversial change in Hercules (and in the RO emulator scene in general), code review is part of the workflow of most software projects, both open source and closed source, and has many benefits.
     
    Why Code Review
     
    The benefits of code review are several:
    "Given enough eyeballs, all bugs are shallow" [Linus's Law by Eric S. Raymond -- The Cathedral and the Bazaar, 1999]. While the law is not strictly true, it's certainly true that the more developers read and analyze a piece of code, the more likely it is that bugs that might be hidden in it are discovered early. Testing is not enough. It's very hard (or in the case of our codebase just plain impossible) to cover all the possible edge cases when testing a new feature or a fix. An additional pair of eyes reading the code may help discovering those more easily. This includes cases where the client would normally prevent a certain thing from happening, but it's not ensured anywhere on the server side. Better quality of code. By having other developers read a piece of code, they'll end up wondering why a certain approach was taken, rather than another, and discuss it with the submitter, leading to better, more efficient algorithms, or better engineered code. Better documentation. Since the code needs to be read by other people, it'll require proper comments (or they'll ask for explanations about the parts they can't easily explain). This increases the chance that the author, or anyone else that will need to read the same code again months or years after it's been submitted, will be able to understand it again, by finding appropriate comments in the appropriate parts of the code. Better insight into the code across the team. By reading code from different parts of the emulator as part of the review process, every team member increases their own general knowledge of the software, bit by bit. This is a very efficient way of learning how different parts of the emulator work, and why they were implemented that way. Future-proofing. By having public reviews, we keep a permanent trace of what were the hot topics and why certain decisions were taken, when a certain part of the emulator was implemented. If a bug arises, or something needs to be redesigned in future, we can look up the associated pull request and related discussion, and learn more about the discussion that went on in the past, and what's hiding behind code design decisions. Reviewing code from other people, as well as having one's own code reviewed by others might not be easy for everyone, especially at the beginning, but please try your best. Here are some suggestions on how to approach code review from either side. 
    How to approach code review (for code authors)
     
    As a code author, the worst thing you can do is to be afraid or shy about other people judging your code. This is the wrong approach! Don't be shy, have your code looked at by others, have them praise you for your genial approach to tackle a problem, listen to their suggestions on how to improve it. But be ready to defend your implementation, if you believe it's better than the suggestions you receive, or if the critics that are moved against it are wrong or meaningless.
     
    Always keep in mind that:
    Having your code reviewed and commented on isn't humiliating. Other people are spending their time looking at your code, asking you why you did something in a certain way rather than another, suggesting improvements. Both sides have a lot to learn from each others. (On the other hand, if no one reviews your code, that's somewhat humiliating!) If someone spots an issue in your code, it doesn't mean that you're a bad developer. We all make mistakes, and we should be happy to learn from them (and it's definitely better if someone spots them and points them out to us before it's too late and they were able to do some harm). Never, ever, take code review personally. No one will laugh about you, fire you, kill you, shame you, etc. if your code is commented on. If you believe you're right and the comments you received are pointless or wrong, chance is that you really are right. Be ready to defend your reasons, it's possible that the reviewer didn't think of them. It is your duty to explain them your reasons. How to approach code review (for code reviewers) 
    Reviewing code is several orders of magnitude harder than having your own code reviewed. You have to check the code for several classes of problems, point out your findings, suggest improvements. And you still have to deal with the worry about hurting the code author's feelings when pointing out a mistake.
     
    Here are some things you should keep in mind when reading and reviewing code from other people:
    You're not judging a person. You're judging code. Don't make your review sound personal. Always think of uncommon and edge cases, and never assume they can't happen, unless there's an explicit check that makes them impossible to happen. Even if the code was tested by the author, it doesn't mean that it can't cause problems to other existing features, or have some issues the author couldn't think of. If the same person writes and tests a piece of code, the chance that they don't test the cases they forgot to handle while coding, is very close to 100%. If the code is not following the project's style guidelines (and this isn't just about indentation, but also about names, conventions about function calls, proper modularization, etc), it is your duty to point it out now, before it's merged. This will make the life of your fellow developers easier later on. Think defensively. Consider the code you have in front of you as buggy until you can prove its correctness. If you see that a sanity check is missing, ask the author to add it. If you believe that a function returns the wrong value in certain cases, even if very unlikely to occur, prepare an example of input for which that happens and point it out. Remember that threats such as overflows, underflows, buffer overruns, null pointers, invalid pointers, numeric (floating point) approximation, etc. are always behind the corner, check for them as often as possible and prove that they can't occur. And remember that, while the code author isn't your enemy (and code review shouldn't generate negative feelings), it's often a good idea to think of them as your "professional enemies". There's a chance that something nasty is hiding in their code, even if they didn't write it with ill intent, and as such, you shouldn't blindly trust the code, regardless of who the author is. Don't be afraid when you comment on other people's code. Your goal isn't to hurt their feelings, you're asking them for explanations and/or suggesting the way you would have done something. Likewise, don't be afraid of making a pointless comment. If the author has a good reason for their implementation, be ready to take back your comment and learn from them. Don't accept compromises. If you're firmly convinced that the author's defense of their code is wrong, your duty is to prove them wrong. But if they manage to convince you, don't be ashamed of admitting you were wrong. Happy reviewing!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.