-
Content Count
382 -
Joined
-
Days Won
38
Posts posted by Haru
-
-
You'll also need CREATE TEMPORARY TABLE and DELETE for normal usage.I mean, is it okay if I could make a user for fluxcp with only Data: "Select","Insert",& "Update" sql permissions?
If you want yo use the builtin install/upgrade functions, you'll also need CREATE, ALTER, DROP, INDEX.
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.
is that advisable to do? @_@Try Turning off PHP Safe Mode
http://support.godaddy.com/help/article/119/turning-off-php-safe-mode-on-your-server
-
-
There was a problem with direct input in the textarea (file upload wasn't affected). It's all fixed now.
-
*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.
-
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.
-
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.
-
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)
-
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)
-
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.)
-
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)Why not rewrite getvariableofnpc to behave like an identifier and work just like a regular variable would?
getvariableofnpc(.foo, "My Other NPC") = 1;
If you have any good ideas... I don't :x
-
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.)I don't know why nobody ever says anything about using Allman style, in my opinion it's the easiest to read and to maintain.
if (condition){}else{}
Or even a variation that I personally prefer to read:if( condition ){}else{}
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.)And why don't use set to define variables? If it's not all right to use this syntax we should "remove" it from our documentation and just leave the entry in our source to keep backwards-compatibility.
An example where it is necessary is when you want to set a variable from another npc:
set getvariableofnpc(.foo, "My Other NPC"), 1;
-
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?)
-
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.
-
Failed @ 16please check 20140305 , please
#if PACKETVER >= 20140305
packetKeys(0x116763F2,0x41117DAC,0x7FD13C45); /* Themon */
#endif
-
what keys do I have to put in?I see, my doubts are: what keys do I have to put in? Do I have to make up those keys? Do I have to use three different ones?
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.
pan and Alexandria reacted to this -
Do you mind if you make a complete guide of that? Because there isnt a lot of information. I tried to do it but I had to give up because of the same.
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
-
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)
evilpuncker reacted to this -
-
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
-
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_CHECK
and 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.
-
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).the problem is. their is no zeny in my cluckers.txt
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:Yeah this case sensitivity for variables is a pain xD
although, if i might intrude, where does this originate from?
[Notice]: Conflicting item/script var 'Zeny', prioritising the script var
if (Zeny < 10000) { mes "You don't have enough money."; close;}
-
-
Yup, I think so too (decreasing readability but oh well, if a script is performance-critical)You'll have even better performance if you replace the for loop with a while loop and the two condition with a ternary
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.yeah I immediately noticed some modification on the comb sort
but you just bug the script lol
http://upaste.me/c50310475cfb4a976
screenshot -> http://imageshack.com/a/img33/8201/81nz.jpg
obviously you only see the last few index when having over 1000 index
but the 1st few index are not sorted properly
so, I have to use back my own comb sort
Not so much compared to today's standards, it's a late-2009 iMac with an i7-870 cpu... But it still works reasonably wellhonestly, how fast is your computer o.o
same test as yours
.@total = 1000; generate rand(10000);
comb sort -> 468-530 mili-seconds
iterative merge sort -> 484-499 mili-seconds
bottom-up merge sort -> 327-343 mili-seconds (*own*)
Yes, this is certainly true. As keyworld said, they compile to different assembly, and the for one calls more jump commands.2nd,
keyworld is right
while-loop is faster than for-loop when parse in script engine
the is even a significant difference with this script
same test as before
your original for-loop -> 343-359 mili-seconds
I change into while-loop -> 327-343 mili-seconds
With some luck, we might be able to get an even faster implementation. Just theoretical right now, but there's something in the workskeyworld has proposed an improvements to the looping with rathena script engine
http://rathena.org/board/topic/81457-hardcoded-script-commands-improvement/
any chance this might get implement in hercules ?
That's to avoid affecting the original array, and let the function work on a local copy when it does the swaps.Haru also copyarray .@arr from getarg(0) in the comb sort function
which is not I want
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?http://rathena.org/board/topic/92070-suggestion-new-scriptcommand-search-array/?p=242896
here is a real examplewhen search through an index, the script usually already has 2 or more array being called
example like
getinventorylist
@inventorylist_id[] ...
@inventorylist_amount[]
if you want to sort @inventorylist_id array, the @inventorylist_amount array needs to sort as well
http://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
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] ]:
(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?
-
Here's some optimizations to those functions, as well as an iterative, bottom-up implementation of mergesort.
This is how they perform on my Hercules copy, using 1000-element arrays:
Mergesort (recursive):
[Debug]: script debug : 0 110000001 : time used -> 131 milli-seconds
Mergesort (bottom-up):[Debug]: script debug : 0 110000002 : time used -> 89 milli-seconds
Combsort:[Debug]: script debug : 0 110000003 : time used -> 98 milli-seconds
For question 2: what about a parallel array of indices, that you swap when you swap the main one?
Flux Control Panel for Hercules
in Repository News
Posted
If it's 5.4.x, then there's no safe mode anymore. It is already disabled.