Jump to content

Haru

Administrators
  • Content Count

    382
  • Joined

  • Days Won

    38

Everything posted by Haru

  1. If it's 5.4.x, then there's no safe mode anymore. It is already disabled.
  2. You'll also need CREATE TEMPORARY TABLE and DELETE for normal usage.If you want yo use the builtin install/upgrade functions, you'll also need CREATE, ALTER, DROP, INDEX. is that advisable to do? @_@ Safe Mode is broken by definition (it tries to solve a problem it should not try to solve at the language interpreter's level.) It was deprecated in of PHP 5.3 and removed in PHP 5.4. Since php 5.2 is unsupported (as of 3 years ago), and php 5.3 is at end-of-life, you can consider safe_mode as some legacy feature that soon won't be available anymore in any production server.
  3. Fixed in https://github.com/HerculesWS/Hercules/commit/5955d81ac5360e073c66f961c2750da4645860bb - thank you
  4. Haru

    item_db2

    There was a problem with direct input in the textarea (file upload wasn't affected). It's all fixed now.
  5. *throws note* The script header should contain a reference to what license the script uses ("GNU General Public License version 3 or later" for all the currently-shipping scripts, unless otherwise specified). The GPL encourages us to do so, because it makes it clear what the license is, even if the file is distributed separately from the emulator.
  6. I don't have a chance to check Notepad (I'm not on windows, so I don't have that), but I guess with "ANSI" they mean "the appropriate local charset for whatever language this computer is set to", which would produce Big5 or some variant of it in your case, so that's what you should use. Again, this is just a guess. The broken lines from the .txt file you posted (if I load it as Big5) are: 5574,Pencil_In_Mouth,叼在嘴?媢]筆,4,20,,100,,0,,0,0xFFFFFFFF,63,2,1,,10,0,555,{ bonus bDex,2; bonus bHitRate,3; },{},{}7156,Broken_Shuriken,破舊之手?媦C,3,470,,10,,,,,,,,,,,,,{},{},{}(I wrote #5571, but I meant #5574, sorry). The questionmark is there to say that it wasn't able to load some character, I'm not sure why it happens.
  7. You shouldn't use utf8 for your files (Hercules and *Athena don't really support it, nor does the client). You should save it with the same file encoding as your original file (which seems to be Big5, but it also seems to be broken, my text editor warns me about issues on line 3389 (item #5571) and line 4481 (item #7156) of your .txt file) You might want to fix those names in your .txt file first, then try to re-convert it, and save the .conf file as Big5 as well. Please note that your item scripts contain errors though (wrong case, wrong arguments, non existent functions, etc), so you'll also need to edit it in order to work with Hercules.
  8. npc/quests/newgears/2005_headgears.txt has a block with twelve indents, but it's inside several switch() blocks, so it'll decrease to just 7 if you use single-indentation for switch/case. npc/quests/seals/megingard_seal.txt has a line with eleven indents, and a block with ten (and those aren't heavily nested inside switch/case)
  9. Before deciding on the line length (I'm personally for 80, but I'm still fine with 120), I think we should check if limiting it to 80 would cause issues with some scripts (too many indentation levels, or too many NPC headers too wide to fit, since those can't be split into multiple lines, and need to be an exception to the line-length rule, and would cause horizontal scrolling regardless)
  10. Yeah, I don't think it's wise to change the NPC header at this point, no matter which standard we agree on. The only affected things would be what's inside, not the "top level commands". In any case, here's one more reason for me to prefer K&R/Kernel style to Allman. Look at how they fold: (screenshots taken in vim, with :set foldmethod=indent) First screenshot only has as many lines as it needs to show the structure, one element per line. Second one seems like an excess of wasted space (two or three extra lines for each fold), and on long scripts it makes it much harder to understand at a glance, since unless you have a large screen, you won't be able to see the entire structure at once. I'm not sure if it's just me, but, by looking at those screenshots, I also notice how, in the first one, the first two if conditions are separated while all the others are connected by if-else. In the second screenshot, that's not so immediately evident unless you actually read the code. And enforcing a blank line between if blocks if they're not related to each others would feel like rubbing salt on the wound (producing extra, unnecessary vertical whitespace.)
  11. I can't think of a proper way to do so... The language syntax doesn't let you assign a value to the result of a function, probably because functions don't have a return type (and even when they in fact normally return a reference, you can't know that at parse time, because they could return void at parse time)If you have any good ideas... I don't :x
  12. I disagree. It makes it unclear at first sight that the block is related to that specific if statement, and it uses too much vertical space unnecessarily. (For the same reason why I dislike excessive amounts of empty lines inside functions, in general. The less lines of code you can fit in your screens, the harder it becomes to understand what a function does.) In some (very few) cases it's necessary to use it, so it needs to be kept in the documentation (perhaps also noting that it is deprecated and it should not be used unless strictly necessary.) An example where it is necessary is when you want to set a variable from another npc: set getvariableofnpc(.foo, "My Other NPC"), 1;
  13. Nice, I like this. Here's my feedback: - I believe 'else' and 'else if' statements are less confusing if they're placed on the same line as the closing curly brace of the preceding 'if' block. To say, I prefer '} else if (something) {'. This is just personal preference though. - Maximum line length should be either 80 or 120 characters. Any more than that is annoying. - We already have a way to split strings across lines. It's almost as you suggested, but with one difference: you need to terminate the string with " after each line (the script parser detects them and joins them while loading the script, just like it happens in c): announce "this is such a great and big announcement" " that can maybe be inside of an" " official script, how will you cut" " it out?", bc_all;After being parsed, the string will contain no extra spaces, and won't cause any concatenation operations at runtime, just as if it was written on one line. - One line if-else statements are fine without braces. But if either the if or the else needs braces, then both should have them (Kernel-style). - 'switch', 'for', 'while', should be treated the same way as 'if' (a space between the keyword and the parentheses) to better differentiate them from function calls. - No camel case please... it's ugly... (personal_preference). Regardless of the camel-case preference, though, it might be worth to recommend to avoid capitalizing the first letter of variable names, so that they won't conflict with item name constants. - Considering how frequently we use nested 'switch' statements, I think the 'case' labels should be indented with the enclosing block (Kernel-style), so that each switch statements takes up one indentation level rather than two. I'm suggesting this because it'd cause line-length issues (and horizontal scrollbars) in many scripts. - I'd add a note about using tabs to indent (at the beginning of the line), and spaces to align (at mid-line, i.e. to align comments or values) - I'd add a note about the naming of functions (perhaps F_name?) and labels (perhaps OnSomething?)
  14. Also, is the database hosted remotely? (since I'm guessing you don't run Hercules in a shared web-host.) A slow connection between the database host and the web host can be at fault, too.
  15. what keys do I have to put in? If you don't want to make them up, you can use the keys from any working client (you can find them in src/map/packets.h). Refer to the list posted by KeyWorld to know which ones can be safely used. Do I have to make up those keys? Possibly not. Generate your own keys only if (1) you know exactly how the algorithm works; (2) you are not Gravity; (3) you know how to generate strong keys. I do not have any recommendations, as I don't have an algorithm to generate strong keys. I'm only able to recognize some classes of weak keys, but some keys I consider strong, may have other weaknesses. Just use keys from other client versions, since both I and KeyWorld have tested them with over 10 million iterations. Do I have to use three different ones? This is not strictly necessary.
  16. If you're using NEMO v.2.0 or newer, it's pretty easy to do it when hexing your client. Just enable the three "Packet __ Key Encryption" patches, and input the desired values. Then edit your src/map/packets.h, adding a line like this near the end of your file (replacing FIRSTKEY, SECONDKEY and THIRDKEY as appropriate): // Add me before the '#endif /* _MAP_PACKETS_H */' linepacketKeys(0xFIRSTKEY,0xSECONDKEY,0xTHIRDKEY);Altermatively, if you don't want to edit source files, and you're compiling through ./configure and make, you can use the following (again, replace with your actual keys):./configure --with-key1=0xFIRSTKEY --with-key2=0xSECONDKEY --with-key3=0xTHIRDKEY
  17. Out of the current, unmerged, branches: - rathena : It's being kept for historical reference, but it is no longer updated now that rAthena is on GitHub (it'd be pointless and it'd make our repository even larger) - zones : It was already there before I joined, so I know very little about it. I believe it's a dropped project favor of the HPM interfaces. Ind perhaps knows more about it than I do... - bcrypt : Stalled until further notice. Gepard is on hiatus, and he's the branch author, even though I have contributed to it as well. I can consider resuming to work on it myself if there's enough demand, but there are some performance concerns that need to be solved/mitigated. It would also require a rewrite of the authentication (and brute-force mitigation) part in control panels or other third party software before being usable. There are also other branches being developed, but they're not part of the main repository yet because they're not mature enough (some of us have branches in their own GitHub fork of the repository) Edit: I forgot to mention, none of those branches has its history set in stone yet, so they should be only used if you know to recover your working copy from a history rewrite (rebase, etc)
  18. Try importing the mob_db table. It is used by the character view page to retrieve info about pets.
  19. We need to pull this change from upstream (paypal issue description in the commit message): https://code.google.com/p/fluxcp/source/detail?r=1133
  20. Do you have items or mobs with those names? AegisNames in the Item DB and SpriteNames in the mob DB are used by the script engine for things like getitem Red_Potion, 1;monster "prontera", 150, 150, "Pink Jelly", PORING, 1;and as such, they can't be duplicate (and can't be the same as script variables. The first error is telling you that you have a something with the same name as the 'monster' script command. You can safely ignore it, but if you want to silence it, find this code in script.c: #ifdef ENABLE_CASE_CHECK if( (strncmp(p, ".@", 2) == 0) ) // Local scope vars are checked separately to decrease false positives existingentry = script->local_casecheck.add_str(p); else { existingentry = script->global_casecheck.add_str(p); if( existingentry ) { if( strcasecmp(p, "disguise") == 0 || strcasecmp(p, "Poison_Spore") == 0 || strcasecmp(p, "PecoPeco_Egg") == 0 || strcasecmp(p, "Soccer_Ball") == 0 || strcasecmp(p, "Horn") == 0 || strcasecmp(p, "Treasure_Box_") == 0 || strcasecmp(p, "Lord_of_Death") == 0 ) // Known duplicates, don't bother warning the user existingentry = NULL; } } if( existingentry ) { DeprecationWarning2("script_add_str", p, existingentry, script->parser_current_file); // TODO }#endif // ENABLE_CASE_CHECKand add another '|| strcasecmp(p, "monster") == 0' to the condition.Or simply rename your variable/item's AegisName to something else if you prefer not to make a source edit for this. Second error is usually because of a mob named EMPERIUM. Rename it to MY_EMPERIUM, or EMPERIUM_, so that it won't conflict with the 'Emperium' item AegisName. In any case, I improved a little the error reports, so that it no longer shows the last script it parsed, when it doesn't have any idea about the error source.
  21. The reported filename may be incorrect. I just committed a patch that should lead to less misleading error reports (and now shows Unknown when it doesn't have a clue, rather than simply showing the last parsed script). If it appears upon player login, it might not be related to any script at all. Doublecheck your SQL database (char_reg_num_db) to see if you have leftovers of a variable named 'zeny', and remove them. This might now have anything to do with case sensitivity at all, but rather item name constants. If you have an item whose AegisName is 'Zeny' (guessing it's coming from a certain extended shop patch), change it to something else ('Zeny_' or 'Zeny_Token' are good options there). It's complaining because if you have an item with Zeny as AegisName, it'll never know if you want to use the item ID or the player parameter, in cases such as this:if (Zeny < 10000) { mes "You don't have enough money."; close;}
  22. Yep, it's slower because it does more operations, since it needs to swap values from two arrays instead of one~
  23. Yup, I think so too (decreasing readability but oh well, if a script is performance-critical) Ah I just noticed an error in the script. In the do/while condition, there's a .@gap > 10 that should be .@gap10 > 10 (I had to introduce that extra gap10 variable because of some checks that were getting messed up because of the division by 1.3, and forgot to update it through the script. Not so much compared to today's standards, it's a late-2009 iMac with an i7-870 cpu... But it still works reasonably well Yes, this is certainly true. As keyworld said, they compile to different assembly, and the for one calls more jump commands. With some luck, we might be able to get an even faster implementation. Just theoretical right now, but there's something in the works That's to avoid affecting the original array, and let the function work on a local copy when it does the swaps. here is a real examplehttp://upaste.me/1d2110474e08867d3 screenshot -> http://imageshack.com/a/img33/778/oyn5.jpg EDIT: -> forgot to tell getitemname2 function come from here if you try to do dispbottom .@output[.@i], .@output is actually just the index of the array I want to sort the ID, I also want to sort the parallel array such as @inventorylist_amount and so on so I only output the sorted index and put them in as @inventorylist_id[ .@output[.@i] ]; and so on along with the parallel arrays Hmm, I see. Then how about, instead of using the .@output array as index, you sort @inventorylist_id, and whenever you do one swap on it, you do the very same swap on @inventorylist_amount as well? Here's two examples (untested, sorry if there's any error). First one sorts in place *both* the original arrays, so you just need to print @inventorylist_id[.@i] and @inventorylist_amount[.@i]. Second one should be what you wanted, it doesn't sort the original arrays at all, and only returns the array of sorted indices, so that you need to print @inventorylist_id[ .@output[.@i] ] and @inventorylist_amount[ .@output[.@i] ]: http://upaste.me/5c1c8f (changing the for() to while() is left as an exercise to the reader ) //Edit: did I ever say I hate IPB's broken bbcode parser?
  24. Here's some optimizations to those functions, as well as an iterative, bottom-up implementation of mergesort. http://upaste.me/20dc8e This is how they perform on my Hercules copy, using 1000-element arrays: Mergesort (recursive): [Debug]: script debug : 0 110000001 : time used -> 131 milli-secondsMergesort (bottom-up):[Debug]: script debug : 0 110000002 : time used -> 89 milli-secondsCombsort:[Debug]: script debug : 0 110000003 : time used -> 98 milli-secondsFor question 2: what about a parallel array of indices, that you swap when you swap the main one?
×
×
  • Create New...

Important Information

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