Re: [Add-On] Super Gachapon
Why do people even bother to use switch, it's dumb.
Re: [Add-On] Super Gachapon
The methods seem more useful then the NPC.
Re: [Add-On] Super Gachapon
Quote:
Originally Posted by
Rice
Why do people even bother to use switch, it's dumb.
Switch / case is faster than if / else >_>
Quote:
In some languages and programming environments, the use of a case or switch statement is considered superior to an equivalent series of if-else statements because it is:
* easier to debug (e.g. setting breakpoints on code vs. a call table, if the debugger has no conditional breakpoint capability)
* easier to read (subjective)
* easier to understand and therefore
* easier to maintain
Additionally, as mentioned above, an optimized implementation may:
* execute much faster than the alternative, because it is often implemented by using an indexed branch table
For example, deciding program flow based on a single character's value, if correctly implemented, is vastly more efficient than the alternative, reducing instruction path lengths considerably.
@magelight: They are rofl. And I answered your npc prob on my thread.
Re: [Add-On] Super Gachapon
reloadChar is useless, there's a packet to update equip stats. There's a packet to update character appearance too.
Also switch isn't faster than if in Java
edit:
lol
Quote:
* execute much faster than the alternative, because it is often implemented by using an indexed branch table
For example, deciding program flow based on a single character's value, if correctly implemented, is vastly more efficient than the alternative, reducing instruction path lengths considerably.
This is not done here, and you can probably do this using if/else too
Re: [Add-On] Super Gachapon
Quote:
Originally Posted by
SuperLol
reloadChar is useless, there's a packet to update equip stats. There's a packet to update character appearance too.
Also switch isn't faster than if in Java
edit:
lol
This is not done here, and you can probably do this using if/else too
What packet might that be?
And thanks for the info on if/else and switch.
Re: [Add-On] Super Gachapon
I don't see the "Super" part of this, this one just gave me more reasons to sleep...
Re: [Add-On] Super Gachapon
hmmm, nice release =D I'll tell you if it has any problem with it
Re: [Add-On] Super Gachapon
Re: [Add-On] Super Gachapon
Quote:
Originally Posted by
Rice
Why do people even bother to use switch, it's dumb.
It's more organized and you don't have to put in tons of }else if(){
Re: [Add-On] Super Gachapon
So you did release it chris, good job o-o.
@Osiris, "Super Gachapon" was my name for it because I made a rough draft. It was his idea tho ;)
Re: [Add-On] Super Gachapon
Quote:
Originally Posted by
Jash
It's more organized and you don't have to put in tons of }else if(){
Well that's true, but you have a fat list of lines of case and breaks. I use switch sometimes since it's a little easier to read but if statements are more powerful. What if you wanted a range of numbers: so 1-100 would return 1, 101-2400 would return 2, otherwise return -1? Then you'd use if. Switch looks better in some cases such as if (x==1||x==3||x==100|x==235||x=25) {}
Re: [Add-On] Super Gachapon
PHP Code:
var Prizes = [["common prizes"], ["standard prizes"], ["rare prizes"], ["extremely rare prizes"]];
should be:
PHP Code:
var Prizes = ["common prizes", "standard prizes", "rare prizes", "extremely rare prizes"];
I don't see whats the point of the extra brackets
Re: [Add-On] Super Gachapon
Quote:
Originally Posted by
iAkira
PHP Code:
var Prizes = [["common prizes"], ["standard prizes"], ["rare prizes"], ["extremely rare prizes"]];
should be:
PHP Code:
var Prizes = ["common prizes", "standard prizes", "rare prizes", "extremely rare prizes"];
I don't see whats the point of the extra brackets
Like i said, the very base of this NPC is mine. I did that because instead of handling it in seperate arrays, you could set it up like [rare], [common], etc etc. You could randomize each array seperately, that was the original intent. If you did it like your suggesting Akira, it would completely defeat the purpose :(:
Either way. I too find the methods more useful *copy pastes* :D:
Re: [Add-On] Super Gachapon
Quote:
Originally Posted by
iAkira
PHP Code:
var Prizes = [["common prizes"], ["standard prizes"], ["rare prizes"], ["extremely rare prizes"]];
should be:
PHP Code:
var Prizes = ["common prizes", "standard prizes", "rare prizes", "extremely rare prizes"];
I don't see whats the point of the extra brackets
4 separate classifications of item IDs, so I used 4 separate arrays.
PHP Code:
[[lvl 30 claw id, lvl 30 sword id], [lvl 50 claw id, lvl 50 sword id], [lvl 100 gear, more lvl 100 gear], [timeless shit, timeless shit]];
Just as an example.
If you had reviewed the whole script you probably would have gotten your answer.