Jump to content

Ryokem

Members
  • Posts

    205
  • Joined

  • Last visited

Everything posted by Ryokem

  1. Yeah LOL, I noticed it too late, just right after posting the message. Updated Post#20 anyway :3 EDIT: Yeah, the idea itself is pretty nice, just you have to work out about how to structure it to optimize your code.
  2. LOL At the pool question and answer XD
  3. EDIT: Ops, didn't see the EDIT on first post, my bad. Not only it reduces the number of lines of the script, but it seriously reduce the compiletime and the runtime of that script.EDIT 2: Lemme criticize the script a little bit, showing some errors or optimizations that can be easily done: mes "Welcome to Casino Roulette!"; goto RouletteStart; close; RouletteStart: Totally useless goto. If the script falls into a label line, it just starts to run it. Easy optimization: mes "Welcome to Casino Roulette!"; Roulette Start: switch(rand(0,36)) { case 0: goto Slot00; case 1: goto Slot01; case 2: goto Slot02; case 3: goto Slot03; case 4: goto Slot04; case 5: goto Slot05; case 6: goto Slot06; case 7: goto Slot07; case 8: goto Slot08; case 9: goto Slot09; case 10: goto Slot10; case 11: goto Slot11; case 12: goto Slot12; case 13: goto Slot13; case 14: goto Slot14; case 15: goto Slot15; case 16: goto Slot16; case 17: goto Slot17; case 18: goto Slot18; case 19: goto Slot19; case 20: goto Slot20; case 21: goto Slot21; case 22: goto Slot22; case 23: goto Slot23; case 24: goto Slot24; case 25: goto Slot25; case 26: goto Slot26; case 27: goto Slot27; case 28: goto Slot28; case 29: goto Slot29; case 30: goto Slot30; case 31: goto Slot31; case 32: goto Slot32; case 33: goto Slot33; case 34: goto Slot34; case 35: goto Slot35; case 36: goto Slot36; } end; WheelSpin: Slot00: cutin "RouletteWheel0",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"0","3","4","3","3","4","RouletteWheel0","green"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot32: cutin "RouletteWheel32",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"32","1","2","1","1","3","RouletteWheel32","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot15: cutin "RouletteWheel15",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"15","2","3","2","2","2","RouletteWheel15","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot19: cutin "RouletteWheel19",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"19","1","1","1","2","2","RouletteWheel19","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot04: cutin "RouletteWheel04",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"4","2","1","2","1","1","RouletteWheel04","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot21: cutin "RouletteWheel21",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"21","1","3","1","2","2","RouletteWheel21","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot02: cutin "RouletteWheel02",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"2","2","2","2","1","1","RouletteWheel02","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot25: cutin "RouletteWheel25",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"25","1","1","1","2","3","RouletteWheel25","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot17: cutin "RouletteWheel17",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"17","2","2","2","2","2","RouletteWheel17","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot34: cutin "RouletteWheel34",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"34","1","1","1","1","3","RouletteWheel34","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot06: cutin "RouletteWheel06",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"6","2","3","2","1","1","RouletteWheel06","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot27: cutin "RouletteWheel27",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"27","1","3","1","2","3","RouletteWheel27","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot13: cutin "RouletteWheel13",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"13","2","1","2","2","2","RouletteWheel13","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot36: cutin "RouletteWheel36",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"36","1","3","1","1","3","RouletteWheel36","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot11: cutin "RouletteWheel11",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"11","2","2","2","2","1","RouletteWheel11","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot30: cutin "RouletteWheel30",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"30","1","3","1","1","3","RouletteWheel30","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot08: cutin "RouletteWheel08",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"8","2","2","2","1","1","RouletteWheel08","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot23: cutin "RouletteWheel23",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"23","1","2","1","2","2","RouletteWheel23","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot10: cutin "RouletteWheel10",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"10","2","1","2","1","1","RouletteWheel10","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot05: cutin "RouletteWheel05",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"5","1","2","2","2","1","RouletteWheel05","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot24: cutin "RouletteWheel24",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"24","2","3","1","1","2","RouletteWheel24","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot16: cutin "RouletteWheel16",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"16","1","1","2","1","2","RouletteWheel16","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot33: cutin "RouletteWheel33",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"33","2","3","1","2","3","RouletteWheel33","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot01: cutin "RouletteWheel01",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"1","1","1","2","2","1","RouletteWheel01","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot20: cutin "RouletteWheel20",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"20","2","2","1","1","2","RouletteWheel20","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot14: cutin "RouletteWheel14",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"14","1","2","2","1","2","RouletteWheel14","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot31: cutin "RouletteWheel31",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"31","2","1","1","2","3","RouletteWheel31","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot09: cutin "RouletteWheel09",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"9","1","3","2","2","1","RouletteWheel09","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot22: cutin "RouletteWheel22",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"22","2","1","1","1","2","RouletteWheel22","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot18: cutin "RouletteWheel18",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"18","1","3","2","1","2","RouletteWheel18","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot29: cutin "RouletteWheel29",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"29","2","2","1","2","3","RouletteWheel29","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot07: cutin "RouletteWheel07",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"7","1","1","2","2","1","RouletteWheel07","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot28: cutin "RouletteWheel28",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"28","2","1","1","1","3","RouletteWheel28","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot12: cutin "RouletteWheel12",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"12","1","3","2","1","1","RouletteWheel12","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot35: cutin "RouletteWheel35",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"35","2","2","1","2","3","RouletteWheel35","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot03: cutin "RouletteWheel03",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"3","1","3","2","2","1","RouletteWheel03","red"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; Slot26: cutin "RouletteWheel26",2; if(.@TotalCount==.@TotalBounce) { setarray .@RouletteDetails$[0],"26","2","2","1","1","3","RouletteWheel26","black"; goto BallStop; } else { set .@TotalCount,.@TotalCount+1; } sleep2 50; if(.@TotalCount<.@TotalBounce) { goto WheelSpin; close; } This whole part can be easily replace with a fuction, that makes the script cleaner, easier to read, faster to compile and faster to run. .@RouletteDetails$ variable can be really omitted as all the information it stores can be retrieve from pre-set variables you should have initialize throgh OnInit or similar. You are abusing of "atoi" command a little bit too much. Atoi basically uses a stringstream based on bitmasks, that needs really too many checks to run. It's a nice command, used a lot, but not to abuse of. It can slow down everything, other then easily break up into some weir errors about converting not-numeric strings. Just create an integer array, and if you need to pass the number to a string (I really don't see why you should put numbers into strings), just use a normal set. set .@string$, "" + .@integer; All the other problems were shown by Key-kun, so I didn't really explained details about that as he owned the theory.
  4. Oh, I missed the post in which he said it was for a daily quest o.O sorry about that. Anyway I was not shutting down any suggestion, I was just poining out about the "what if not...". the aim was to look after some general methods as he said he was done with solving the problem. Yeah exactly, I made this sort of script long ago when I was scripting for a server, or at least something that worked similar. Would be awesome to get it back
  5. By the way, are you sure you can run an @command without any RID attached? 'Cause actually sleep will detach the RID if a player is attached. Wouldn't you fall into a "rid not attached" error?
  6. Haha I missed that command. As there is changesex command, of course it's much better than use atcommand.
  7. Again, I totally agree. But the point is that, who said it's for a quest? What if I want the #var to be X exactly as midnight? Until he tells further details, that's his request. How to set (to an X value) #var of all characters at midnight.
  8. I don't know if this can solve the problem Actually, from the original code... if($KOEGUILD!=0) { //Do things } else { //Do things } query_sql "UPDATE guild SET guild_points=guild_points +1 WHERE guild_id="+ getcharid(2); So I believe $KOEGUILD variable can even be 0, and actually guild_id=0 won't really work I believe.
  9. Exactly, you need to reorganize of course. But that's not the best way about how to reorganize it. I would procede as follow: OnInit: .@interval = 2; .@step = 5; while (1) { if ( gettime(4) != 0 && gettime(4) != 2 ) { // add this.... disablenpc strnpcinfo(0); end; } getmapxy .@map$, .@x, .@y, 1; while ( checkcell( .@map$, .@npc_x = .@x + rand( -.@step, .@step ), .@npc_y = .@y + rand( -.@step, .@step ), cell_chknopass ) ); npcwalkto .@npc_x, .@npc_y; npctalk callfunc( "F_RandMes", 2, "Heloo!!!", // 1 "Goodbye~!" // 2 ); sleep .@interval * 1000; } Credits for code @Annie. It's better to leave the check right after sleep ends, for obvious functional reason.
  10. Fully agree, but I was just answering what he wanted to know. He didn't ask for quest variables, or how to solve particular problems about that, he just asked how to set a local account variable every midnight.
  11. Really, people just think they are good scripters 'cause they can make an NPC with "complicated algorithms". BUT how can they even define themselves scripters if they didn't even know what the HEAP is? REALLY. SO disappointing.

  12. please get a test server and test it before you post ... because without that check, the script doesn't want to rununless you can post up a solution that's better than mine and emistry First, I can't get a server test, I can browse rAthena only from university or work, and I can't install a server test there, I apologize if my scripts can contain errors because of that but it can't be helped, if you prefer i will stop posting helping thread, so you may be happy. OnInit: if ( gettime(4) != 0 && gettime(4) != 2 ) { //useless chck in my opinion, let the script enter the while loop and after the sleep interval, this check will be done itself. disablenpc strnpcinfo(0); end; } .@interval = 2; .@step = 5; while (1) { sleep .@interval * 1000; if ( gettime(4) != 0 && gettime(4) != 2 ) { // add this.... disablenpc strnpcinfo(0); end; } getmapxy .@map$, .@x, .@y, 1; //[...] THIS is what I meant. Really.
  13. yeah yeah ... I'm agreeing this point Seriously, how can you agree on this point? There are 1000 ways to check it, with simple debug messages, not needed in an "online check GM"... real. That's disappointing from a great scripter like you... Hope you were sarcastic... Also, abusing of database queries is bad, running query_sql each time a person log in or out is more than a pain... the heap will explode, really. And even if it's a solution, I still believe that it is completely not necessary even to use OnPCLoginEvent for those kind of script. Is really a server going to hire new GMs every day?
  14. Haha nice question! xD Dropping into sql queries is somehow slow if there is not the need.Also, I don't really see the need of using OnPCLogin event as well. Just build an array and check if all GMs in that array are online or not, with Isloggedin function. I don't really think that you hire GM staff every day, so just modify it whenever you will hire someone else.
  15. http://www.eathena.w...dpost&p=1436182well-placed goto will speed up optimization ... just like in this example ... without a goto in this script, I need to use callfunc, because On<starttime>: and OnInit: having repeated feature inside it looks even uglier with callfunc I meant, the previous script you did was way looking better and more efficient, quit that script with goto.(Refering to this post.) Just you did an useless check at the very beginning after OnInit label. As the check is already in the while(1) loop, meanless to check it there too, just leave the sleep interval to drop and wait for that check.
  16. It is the script! As you can see...
  17. There is still a way, but It's pretty odd and requires a lot of memory and heap.
  18. Yeah, but I believe he wanted to set on all accounts, that variable at midnight. You'll need to use a query_sql into an OnMinute00 event label.
  19. use atcommand "@changesex" after checking the class not to be Bard or Dancer.
  20. - script Info -1,{ OnTimer1200000: stopnpctimer; announce "Die aktuellsten Infos zum Server findest du auf www.forum.soro.hy-s.de! ", 0; OnInit: //setnpctimer 0; //Shouldn't be necessary as initnpctimer already set npc timer to 0. initnpctimer; end; }
×
×
  • Create New...