ToiletMaster 3 Posted August 31, 2013 Hi there! as I'm still new towards scripting, most commands I used in my scripts are kind of bad and repetitive. I was thinking whether it could be shorten? Currently the script holds 4000+ lines. http://justpaste.it/5t3n (side reminder, the script works fine without any issues, currently I'm just exploring methods to reduce the script size if possible) Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted August 31, 2013 (edited) To make this short, use a loop : if(checkquest(82000) == 1) goto N_Progress; if(checkquest(82001) == 1) goto N_Progress; if(checkquest(82002) == 1) goto N_Progress; if(checkquest(82003) == 1) goto N_Progress; if(checkquest(82004) == 1) goto N_Progress; if(checkquest(82005) == 1) goto N_Progress; if(checkquest(82006) == 1) goto N_Progress; if(checkquest(82007) == 1) goto N_Progress; if(checkquest(82008) == 1) goto N_Progress; if(checkquest(82009) == 1) goto N_Progress; if(checkquest(82010) == 1) goto N_Progress; if(checkquest(82011) == 1) goto N_Progress; if(checkquest(82012) == 1) goto N_Progress; if(checkquest(82013) == 1) goto N_Progress; if(checkquest(82014) == 1) goto N_Progress; if(checkquest(82015) == 1) goto N_Progress; if(checkquest(82016) == 1) goto N_Progress; if(checkquest(82017) == 1) goto N_Progress; if(checkquest(82018) == 1) goto N_Progress; if(checkquest(82019) == 1) goto N_Progress; if(checkquest(82020) == 1) goto N_Progress; if(checkquest(82021) == 1) goto N_Progress; if(checkquest(82022) == 1) goto N_Progress; if(checkquest(82023) == 1) goto N_Progress; if(checkquest(82024) == 1) goto N_Progress; if(checkquest(82025) == 1) goto N_Progress; if(checkquest(82026) == 1) goto N_Progress; if(checkquest(82027) == 1) goto N_Progress; if(checkquest(82028) == 1) goto N_Progress; if(checkquest(82029) == 1) goto N_Progress; if(checkquest(82030) == 1) goto N_Progress; if(checkquest(82031) == 1) goto N_Progress; if(checkquest(82032) == 1) goto N_Progress; if(checkquest(82033) == 1) goto N_Progress; if(checkquest(82034) == 1) goto N_Progress; if(checkquest(82035) == 1) goto N_Progress; if(checkquest(82036) == 1) goto N_Progress; if(checkquest(82037) == 1) goto N_Progress; if(checkquest(82038) == 1) goto N_Progress; if(checkquest(82039) == 1) goto N_Progress; if(checkquest(82040) == 1) goto N_Progress; if(checkquest(82041) == 1) goto N_Progress; if(checkquest(82042) == 1) goto N_Progress; if(checkquest(82043) == 1) goto N_Progress; if(checkquest(82044) == 1) goto N_Progress; if(checkquest(82045) == 1) goto N_Progress; if(checkquest(82046) == 1) goto N_Progress; if(checkquest(82047) == 1) goto N_Progress; if(checkquest(82048) == 1) goto N_Progress; if(checkquest(82049) == 1) goto N_Progress; if(checkquest(82050) == 1) goto N_Progress; if(checkquest(82051) == 1) goto N_Progress; if(checkquest(82052) == 1) goto N_Progress; if(checkquest(82053) == 1) goto N_Progress; if(checkquest(82054) == 1) goto N_Progress; if(checkquest(82055) == 1) goto N_Progress; if(checkquest(82056) == 1) goto N_Progress; if(checkquest(82057) == 1) goto N_Progress; if(checkquest(82058) == 1) goto N_Progress; if(checkquest(82059) == 1) goto N_Progress; if(checkquest(82060) == 1) goto N_Progress; if(checkquest(82061) == 1) goto N_Progress; if(checkquest(82062) == 1) goto N_Progress; if(checkquest(82063) == 1) goto N_Progress; if(checkquest(82064) == 1) goto N_Progress; if(checkquest(82065) == 1) goto N_Progress; if(checkquest(82066) == 1) goto N_Progress; if(checkquest(82067) == 1) goto N_Progress; if(checkquest(82068) == 1) goto N_Progress; if(checkquest(82069) == 1) goto N_Progress; if(checkquest(82070) == 1) goto N_Progress; if(checkquest(82071) == 1) goto N_Progress; if(checkquest(82072) == 1) goto N_Progress; if(checkquest(82073) == 1) goto N_Progress; if(checkquest(82074) == 1) goto N_Progress; if(checkquest(82075) == 1) goto N_Progress; if(checkquest(82076) == 1) goto N_Progress; if(checkquest(82077) == 1) goto N_Progress; if(checkquest(82078) == 1) goto N_Progress; if(checkquest(82079) == 1) goto N_Progress; if(checkquest(82080) == 1) goto N_Progress; if(checkquest(82081) == 1) goto N_Progress; if(checkquest(82082) == 1) goto N_Progress; if(checkquest(82083) == 1) goto N_Progress; if(checkquest(82084) == 1) goto N_Progress; if(checkquest(82085) == 1) goto N_Progress; if(checkquest(82086) == 1) goto N_Progress; if(checkquest(82087) == 1) goto N_Progress; if(checkquest(82088) == 1) goto N_Progress; if(checkquest(82089) == 1) goto N_Progress; if(checkquest(82090) == 1) goto N_Progress; if(checkquest(82091) == 1) goto N_Progress; if(checkquest(82092) == 1) goto N_Progress; if(checkquest(82093) == 1) goto N_Progress; if(checkquest(82094) == 1) goto N_Progress; if(checkquest(82095) == 1) goto N_Progress; if(checkquest(82096) == 1) goto N_Progress; if(checkquest(82097) == 1) goto N_Progress; if(checkquest(82098) == 1) goto N_Progress; if(checkquest(82099) == 1) goto N_Progress; if(checkquest(82100) == 1) goto N_Progress; if(checkquest(82101) == 1) goto N_Progress; if(checkquest(82102) == 1) goto N_Progress; if(checkquest(82103) == 1) goto N_Progress; if(checkquest(82104) == 1) goto N_Progress; if(checkquest(82105) == 1) goto N_Progress; if(checkquest(82106) == 1) goto N_Progress; if(checkquest(82107) == 1) goto N_Progress; if(checkquest(82108) == 1) goto N_Progress; if(checkquest(82109) == 1) goto N_Progress; if(checkquest(82110) == 1) goto N_Progress; if(checkquest(82111) == 1) goto N_Progress; if(checkquest(82112) == 1) goto N_Progress; if(checkquest(82113) == 1) goto N_Progress; if(checkquest(82114) == 1) goto N_Progress; if(checkquest(82115) == 1) goto N_Progress; if(checkquest(82116) == 1) goto N_Progress; if(checkquest(82117) == 1) goto N_Progress; if(checkquest(82118) == 1) goto N_Progress; if(checkquest(82119) == 1) goto N_Progress; if(checkquest(82120) == 1) goto N_Progress; if(checkquest(82121) == 1) goto N_Progress; if(checkquest(82122) == 1) goto N_Progress; if(checkquest(82123) == 1) goto N_Progress; if(checkquest(82124) == 1) goto N_Progress; if(checkquest(82125) == 1) goto N_Progress; if(checkquest(82126) == 1) goto N_Progress; if(checkquest(82127) == 1) goto N_Progress; if(checkquest(82128) == 1) goto N_Progress; if(checkquest(82129) == 1) goto N_Progress; if(checkquest(82130) == 1) goto N_Progress; if(checkquest(82131) == 1) goto N_Progress; if(checkquest(82132) == 1) goto N_Progress; if(checkquest(82133) == 1) goto N_Progress; if(checkquest(82134) == 1) goto N_Progress; if(checkquest(82135) == 1) goto N_Progress; if(checkquest(82136) == 1) goto N_Progress; if(checkquest(82137) == 1) goto N_Progress; if(checkquest(82138) == 1) goto N_Progress; if(checkquest(82139) == 1) goto N_Progress; if(checkquest(82140) == 1) goto N_Progress; if(checkquest(82141) == 1) goto N_Progress; if(checkquest(82142) == 1) goto N_Progress; if(checkquest(82143) == 1) goto N_Progress; if(checkquest(82144) == 1) goto N_Progress; if(checkquest(82145) == 1) goto N_Progress; if(checkquest(82146) == 1) goto N_Progress; if(checkquest(82147) == 1) goto N_Progress; if(checkquest(82148) == 1) goto N_Progress; if(checkquest(82149) == 1) goto N_Progress; if(checkquest(82150) == 1) goto N_Progress; if(checkquest(82151) == 1) goto N_Progress; if(checkquest(82152) == 1) goto N_Progress; if(checkquest(82153) == 1) goto N_Progress; if(checkquest(82154) == 1) goto N_Progress; if(checkquest(82155) == 1) goto N_Progress; if(checkquest(82156) == 1) goto N_Progress; if(checkquest(82157) == 1) goto N_Progress; if(checkquest(82158) == 1) goto N_Progress; if(checkquest(82159) == 1) goto N_Progress; if(checkquest(82160) == 1) goto N_Progress; if(checkquest(82161) == 1) goto N_Progress; if(checkquest(82162) == 1) goto N_Progress; if(checkquest(82163) == 1) goto N_Progress; if(checkquest(82164) == 1) goto N_Progress; if(checkquest(82165) == 1) goto N_Progress; if(checkquest(82166) == 1) goto N_Progress; if(checkquest(82167) == 1) goto N_Progress; if(checkquest(82168) == 1) goto N_Progress; if(checkquest(82169) == 1) goto N_Progress; if(checkquest(82170) == 1) goto N_Progress; if(checkquest(82171) == 1) goto N_Progress; if(checkquest(82172) == 1) goto N_Progress; if(checkquest(82173) == 1) goto N_Progress; if(checkquest(82174) == 1) goto N_Progress; if(checkquest(82175) == 1) goto N_Progress; if(checkquest(82176) == 1) goto N_Progress; if(checkquest(82177) == 1) goto N_Progress; if(checkquest(82178) == 1) goto N_Progress; if(checkquest(82179) == 1) goto N_Progress; if(checkquest(82180) == 1) goto N_Progress; if(checkquest(82181) == 1) goto N_Progress; if(checkquest(82182) == 1) goto N_Progress; if(checkquest(82183) == 1) goto N_Progress; if(checkquest(82184) == 1) goto N_Progress; if(checkquest(82185) == 1) goto N_Progress; if(checkquest(82186) == 1) goto N_Progress; if(checkquest(82187) == 1) goto N_Progress; if(checkquest(82188) == 1) goto N_Progress; if(checkquest(82189) == 1) goto N_Progress; if(checkquest(82190) == 1) goto N_Progress; if(checkquest(82191) == 1) goto N_Progress; if(checkquest(82192) == 1) goto N_Progress; if(checkquest(82193) == 1) goto N_Progress; if(checkquest(82194) == 1) goto N_Progress; if(checkquest(82195) == 1) goto N_Progress; if(checkquest(82196) == 1) goto N_Progress; if(checkquest(82197) == 1) goto N_Progress; if(checkquest(82198) == 1) goto N_Progress; if(checkquest(82199) == 1) goto N_Progress; if(checkquest(82200) == 1) goto N_Progress; if(checkquest(82201) == 1) goto N_Progress; if(checkquest(82202) == 1) goto N_Progress; if(checkquest(82203) == 1) goto N_Progress; if(checkquest(82204) == 1) goto N_Progress; if(checkquest(82205) == 1) goto N_Progress; if(checkquest(82206) == 1) goto N_Progress; if(checkquest(82207) == 1) goto N_Progress; if(checkquest(82208) == 1) goto N_Progress; if(checkquest(82209) == 1) goto N_Progress; if(checkquest(82210) == 1) goto N_Progress; if(checkquest(82211) == 1) goto N_Progress; if(checkquest(82212) == 1) goto N_Progress; if(checkquest(82213) == 1) goto N_Progress; if(checkquest(82214) == 1) goto N_Progress; if(checkquest(82215) == 1) goto N_Progress; if(checkquest(82216) == 1) goto N_Progress; if(checkquest(82217) == 1) goto N_Progress; if(checkquest(82218) == 1) goto N_Progress; if(checkquest(82219) == 1) goto N_Progress; if(checkquest(82220) == 1) goto N_Progress; if(checkquest(82221) == 1) goto N_Progress; if(checkquest(82222) == 1) goto N_Progress; if(checkquest(82223) == 1) goto N_Progress; if(checkquest(82224) == 1) goto N_Progress; if(checkquest(82225) == 1) goto N_Progress; if(checkquest(82226) == 1) goto N_Progress; if(checkquest(82227) == 1) goto N_Progress; if(checkquest(82228) == 1) goto N_Progress; if(checkquest(82229) == 1) goto N_Progress; if(checkquest(82230) == 1) goto N_Progress; if(checkquest(82231) == 1) goto N_Progress; if(checkquest(82232) == 1) goto N_Progress; if(checkquest(82233) == 1) goto N_Progress; if(checkquest(82234) == 1) goto N_Progress; if(checkquest(82235) == 1) goto N_Progress; if(checkquest(82236) == 1) goto N_Progress; if(checkquest(82237) == 1) goto N_Progress; if(checkquest(82238) == 1) goto N_Progress; if(checkquest(82239) == 1) goto N_Progress; if(checkquest(82240) == 1) goto N_Progress; if(checkquest(82241) == 1) goto N_Progress; if(checkquest(82242) == 1) goto N_Progress; if(checkquest(82243) == 1) goto N_Progress; if(checkquest(82244) == 1) goto N_Progress; if(checkquest(82245) == 1) goto N_Progress; if(checkquest(82246) == 1) goto N_Progress; if(checkquest(82247) == 1) goto N_Progress; if(checkquest(82248) == 1) goto N_Progress; if(checkquest(82249) == 1) goto N_Progress; if(checkquest(82250) == 1) goto N_Progress; if(checkquest(82251) == 1) goto N_Progress; if(checkquest(82252) == 1) goto N_Progress; if(checkquest(82253) == 1) goto N_Progress; if(checkquest(82254) == 1) goto N_Progress; if(checkquest(82255) == 1) goto N_Progress; if(checkquest(82256) == 1) goto N_Progress; if(checkquest(82257) == 1) goto N_Progress; if(checkquest(82258) == 1) goto N_Progress; if(checkquest(82259) == 1) goto N_Progress; if(checkquest(82260) == 1) goto N_Progress; if(checkquest(82261) == 1) goto N_Progress; if(checkquest(82262) == 1) goto N_Progress; if(checkquest(82263) == 1) goto N_Progress; if(checkquest(82264) == 1) goto N_Progress; if(checkquest(82265) == 1) goto N_Progress; if(checkquest(82266) == 1) goto N_Progress; else; return; Short version ( didn't try though ) : @i = 82000;while ( @i < 82267 ) { if( checkquest(@i) ) goto N_Progress; @i++; } Edited August 31, 2013 by Patskie 2 ToiletMaster and Senos reacted to this Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted August 31, 2013 (edited) Its a big work(and don't have time now)so, Have optimized till N_Tuesday Only, You can do other too. check the script Edited August 31, 2013 by Dastgir Pojee Quote Share this post Link to post Share on other sites
0 Emistry 145 Posted August 31, 2013 try... http://upaste.me/r/792e1d Case 0: if( BaseLevel >= 50 && BaseLevel <= 69 ){ setarray .@monster$,"Marc","Bongun","Dustiness","Driller","Wootan Fighter"; setarray .@questid,82006,82013,82020,82027,82034; }else if( BaseLevel >= 70 && BaseLevel <= 99 ){ setarray .@monster$,"Karakasa","Grand Peco","Pasana","Metaling","Dancing Dragon","Mavka","Uzhas","Poison Toad","Zombie Prisoner","Clock Tower Manager","Breeze","Bloody Injustice","Wicked Nymph"; setarray .@questid,82045,82052,82258,82065,82071,82079,82086,82093,82100,82107,82114,82121,82128; }else if( BaseLevel >= 100 && BaseLevel <= 125 ){ setarray .@monster$,"Assaulter","Hill Wind","Kobold (Shield & Hammer)","Diabolic","Muscipular","Dullahan","Aunoe","Venatu (Blue)","Hell Poodle","Dimik (Orange)","Plasma (Red)","Cornus","Remover"; setarray .@questid,82138,82145,82151,82159,82166,82171,82180,82187,82194,82201,82208,82215,82222; }else{ setarray .@monster$,"Shelter","Observation","Banshee","Erend","Antler Scaraba"; setarray .@questid,82232,82239,82246,82254,82261; } break;Case 1: if( BaseLevel >= 50 && BaseLevel <= 69 ){ setarray .@monster$,"Beetle King","Alligator","Rice Cake Boy","Jakk","Mantis","Dryad"; setarray .@questid,82000,82007,82014,82021,82028,82035; }else if( BaseLevel >= 70 && BaseLevel <= 99 ){ setarray .@monster$,"Sidewinder","Nine Tails","Argiope","Iara","Comodo","Punk","Raydric Archer","Penomena","Venomous","Permeter","Teddy Bear","Waste Stove","Stapo","The Paper"; setarray .@questid,82039,82046,82266,82059,82066,82073,82080,82087,82094,82101,82108,82115,82122,82129; }else if( BaseLevel >= 100 && BaseLevel <= 125 ){ setarray .@monster$,"Neraid","Quve","Drosera","Phendark","Sting","Deleter (Flying)","Kobold Archer","Ice Titan","Dark Pinguicula","Plasma(Blue)","Plasma (Green)","Gremlin","Owl Baron","Knight of Abyss"; setarray .@questid,82132,82139,82146,82153,82160,82167,82174,82181,82188,82195,82202,82209,82216,82223; }else{ setarray .@monster$,"Vanberk","Centipede","Frus","Acidus","Necromancer","Salamander"; setarray .@questid,82226,82233,82240,82248,82255,82262; } break;Case 2: if( BaseLevel >= 50 && BaseLevel <= 69 ){ setarray .@monster$,"Goblin Archer","Swordfish","Merman","Hunter Fly","Tri-Joint","Dokebi"; setarray .@questid,82001,82008,82015,82022,82029,82036; }else if( BaseLevel >= 70 && BaseLevel <= 99 ){ setarray .@monster$,"Toucan","Marduk","Dark Frame","Evil Druid","Clock","Les","Novus","Miyabi Doll","Siorova","Marionette","Demon Pungus","Enchanted Peach Tree","Roween","Obsidian"; setarray .@questid,82040,82047,82253,82060,82067,82074,82081,82088,82095,82102,82109,82116,82123,82130; }else if( BaseLevel >= 100 && BaseLevel <= 125 ){ setarray .@monster$,"Siroma","Gargoyle","Blazer","Desert Wolf","Fake Angel","Gazeti","Anolian","Aliza","Draco","Raydric","Plasma (Purple)","Centipede Larva","Beholder","Hodremlin"; setarray .@questid,82133,82140,82147,82154,82161,82168,82175,82182,82189,82196,82203,82210,82217,82224; }else{ setarray .@monster$,"Lady Solace","Echio","Agav","Incantation of Morrocc (Ground)","Rawrel","Rake Scaraba"; setarray .@questid,82227,82234,82241,82249,82256,82263; } break;Case 3: if( BaseLevel >= 50 && BaseLevel <= 69 ){ setarray .@monster$,"Greatest General","Minorous","Strouf","Hode","Steam Goblin","Curupira"; setarray .@questid,82009,82016,82023,82030,82037; }else if( BaseLevel >= 70 && BaseLevel <= 99 ){ setarray .@monster$,"Zerom","Tamruan","Parasite","Goat","Wood Goblin","Mi Gao","Stem Worm","Rafflesia","Noxious","Pitman","Skeleton Prisoner","Solider","Anopheles","Tengu"; setarray .@questid,82041,82048,82254,82061,82068,82075,82082,82089,82096,82103,82110,82117,82124,82131; }else if( BaseLevel >= 100 && BaseLevel <= 125 ){ setarray .@monster$,"Dark Priest","Explosion","Kobold (With Mace)","Lava Golem","Anubis","Nightmare Terror","Loli Ruri","Ancient Mimic","Ancient Mummy","Pot Dofle","King Dramoh","Plasma (Yellow)","Flame Skull","Hillslion"; setarray .@questid,82134,82141,82147,82155,82162,82167,82176,82183,82190,82197,82204,82211,82218,82225; }else{ setarray .@monster$,"Ragged Zombie","Ferus (Green)","Tatacho","Whikebain","Armania","Miming"; setarray .@questid,82228,82235,82242,82250,82257,82264; } break;Case 4: if( BaseLevel >= 50 && BaseLevel <= 69 ){ setarray .@monster$,"Mummy","Munak","Golems","Leaf Cat","Horong","Baby Leopard"; setarray .@questid,82003,82010,82017,82024,82031,82038; }else if( BaseLevel >= 70 && BaseLevel <= 99 ){ setarray .@monster$,"Jaguar","Geographer","Wraith","Headless Mule","Sleeper","Kapha","Cendrawasih","Witch","Spring Rabbit","Novus","Red Eruma","Deviruchi","Shinobi"; setarray .@questid,82042,82049,82255,82062,82068,82076,82083,82090,82097,82104,82111,82118,82125,82132; }else if( BaseLevel >= 100 && BaseLevel <= 125 ){ setarray .@monster$,"Heater","Anacondaq","Lude","Disguise","Deleter (Not Flying)","Kobold (With Axe)","Luciola Vespa","Sropho","Nepenthes","Dimik (Grey)","Naga","Succubus","Aqua Elemental"; setarray .@questid,82135,82142,82148,82156,82163,82168,82177,82184,82191,82198,82205,82212,82219; }else{ setarray .@monster$,"Seeker","Skogul","Imp","Incantation of Morrocc","Kavac","Little Fatum"; setarray .@questid,82229,82236,82243,82251,82258,82265; } break;Case 5: if( BaseLevel >= 50 && BaseLevel <= 69 ){ setarray .@monster$,"Metaller","Isis","Sandman","Stone Shooter","Grizzly"; setarray .@questid,82004,82011,82018,82025,82032; }else if( BaseLevel >= 70 && BaseLevel <= 99 ){ setarray .@monster$,"Requiem","Rideword","Orc Archer","Alnoldi","Raydric Archer","Ancient Worm","Mole","Dragon Tail","Firelock Soldier","Wild Ginseng","Elder","Freezer","Evil Cloud Hermit"; setarray .@questid,82043,82050,82256,82063,82069,82077,82084,82091,82098,82105,82112,82119,82126; }else if( BaseLevel >= 100 && BaseLevel <= 125 ){ setarray .@monster$,"Rybio","Alice","Medusa","Carat","Pinguicula","Majoruros","Magmaring","Venatu (Red)","Ancient Mummy","Dimik (Red)","Mini Demon","Wanderer","Retribution"; setarray .@questid,82136,82143,82149,82157,82164,82169,82178,82185,82192,82199,82206,82213,82220; }else{ setarray .@monster$,"Zombie Slaughter","Knocker","Acidus (Gold)","Dolomedes","Kasa"; setarray .@questid,82230,82237,82244,82252,82259; } break;Case 6: if( BaseLevel >= 50 && BaseLevel <= 69 ){ setarray .@monster$,"Green Iguana","Flora","Ghoul","Sohee","Wootan Shooter"; setarray .@questid,82005,82012,82019,82026,82033; }else if( BaseLevel >= 70 && BaseLevel <= 99 ){ setarray .@monster$,"Wooden Golem","Piranha","Petite","Jing Guai","Cramp","Harpy","Porcellio","Hyegun","Alarm","Zipper Bear","Owl Duke","Bloody Butterfly","Evil Cloud Hermit"; setarray .@questid,82044,82051,82257,82064,82070,82078,82085,82092,82099,82106,82113,82120,82127; }else if( BaseLevel >= 100 && BaseLevel <= 125 ){ setarray .@monster$,"Kaho","Galion","Heirozoist","Snowier","Gibbet","Arclouse","Sedora","Venatu (Grey)","Deathword","Dimik (Blue)","Violy","Incubus","Apocalypse"; setarray .@questid,82137,82144,82150,82158,82165,82170,82179,82186,82193,82200,82207,82214,82221; }else{ setarray .@monster$,"Isilla","Ferus (Red)","One Horned Scaraba","Bradium Golem","Ygnizem"; setarray .@questid,82231,82238,82245,82253,82260; } break; set your quest up there ....the quest id is stored into a player variable "monster_quest" .... it can be even shorter than this ... just some simple trick + math calculation ..xD i believe you can try figure it out soon ... 2 ToiletMaster and Senos reacted to this Quote Share this post Link to post Share on other sites
0 ToiletMaster 3 Posted August 31, 2013 Wow thanks for the assistance everyone! This really is an eye opener in many ways lol thanks again! If there are other methods I wouldn't mind seeing it though xD It really is something great to learn seeing all of these lol @Emistry, Thanks for the script shortening! This is really really short compared to 4800 lines lol ! Quote Share this post Link to post Share on other sites
0 Senos 54 Posted September 1, 2013 Really, your script was very veeeeery optimizableeee! It could also be: for (set @i, 82000; @i < 82267; set @i, @i +1) { if (checkquest[@i]) callsub "N_Progess"; set @i, @i + 1;} In case a loop. Good script Emistry! Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted September 1, 2013 (edited) @Wolf your result is : 82000820028200482006820088201082012820148201682018 Should be : 8200082001820028200382004820058200682007820088200982010 Besides checkquest is not an array checkquest( @i ); // not checkquest[ .@i ] Edited September 1, 2013 by Patskie Quote Share this post Link to post Share on other sites
0 Mumbles 193 Posted September 2, 2013 for (set @i, 82000; @i < 82267; set @i, @i +1) { if (checkquest[@i]) callsub "N_Progess"; set @i, @i + 1;} I don't see much of a difference in the usage of callsub here, in comparison to goto; in either case, it's just sloppy coding and could be written like this: for (@i = 82000; @i < 82267; @i++) { if (checkquest(@i)) { mes "You're currently still performing a quest!"; mes "Please ^FF0000finish the quest or abandon the quest!^000000"; close; } } Using descriptive labels and names is important too, especially when you want to look back at your code and figure out what's going on; comments are useful, but functions named like L_quest, R_quest, and so forth don't tell me or anyone else a whole lot about what the function does. Regardless, calling the functions was a little pointless, as they were both only called once throughout all 4828 lines; it'd make more sense to simply include the content of the function where it was originally called. Here's my method, which is a little prettier than @Emistry's (no offense c:) but basically the same thing. I placed the level checks outside of the switch, as they're only needed once anyways, and organized the entire script to be more readable. It's 358 lines (including the header and comments) versus Emistry's 207 lines, but I like my code to be a little less mashed together. http://upaste.me/b3607239c4edd0b0 1 ToiletMaster reacted to this Quote Share this post Link to post Share on other sites
0 ToiletMaster 3 Posted September 2, 2013 I understand most of the commands used and how they are being used in the script. However one thing I'm not too sure would be the reason of using @i++ example on above for (@i = 82000; @i < 82267; @i++) If someone could clarify on this that would be amazing! As i'm thinking why can't it end at 82267; ? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted September 2, 2013 Oh? It seems documentation is missing information on this. Let me quickly fill you up on the matter: // These all are the same:set @i, @i + 1;@i = @i + 1;@i += 1;@i++; // <-- It's just a unitary increment, just increments the variable in 1 and has no other uses// These others are also the same:set @i, @i - 1;@i = @i - 1;@i -= 1;@i--; // <-- It's just a unitary decrement, just decrements the variable in 1 and has no other uses By no other users I mean you can't use strange things like this: @var++2 or something like that. It just works with ++ or -- and can't do anything else than just incrementing or decrementing the variable by 1. Quote Share this post Link to post Share on other sites
0 Mumbles 193 Posted September 2, 2013 for (@i = 82000; @i < 82267; @i++)If someone could clarify on this that would be amazing! As i'm thinking why can't it end at 82267; ? Oh, I suppose that was my mistake from reading and converting Wolf's loop. You can fix that by simply changing < to <=, like so: for (@i = 82000; @i <= 82267; @i++) Updated the link in my first post with this change. Quote Share this post Link to post Share on other sites
0 Senos 54 Posted September 2, 2013 About this commands and sintax, not adapted yet to form gringa programming , and the callsub, yes, there is not much difference goto since it has no arguments, hehe. Quote Share this post Link to post Share on other sites
0 ToiletMaster 3 Posted September 6, 2013 hope you don't mind if I ask however if let's say I don't place @i++ what's going to happen? Quote Share this post Link to post Share on other sites
0 Patskie 88 Posted September 6, 2013 hope you don't mind if I ask however if let's say I don't place @i++ what's going to happen? The array will not increment. It will stay at index 0 Quote Share this post Link to post Share on other sites
0 ToiletMaster 3 Posted September 15, 2013 hope you don't mind if I ask however if let's say I don't place @i++ what's going to happen? The array will not increment. It will stay at index 0 Ah thanks for letting me know! Cheers! kinda straightforward i guess lol Quote Share this post Link to post Share on other sites
Hi there!
as I'm still new towards scripting, most commands I used in my scripts are kind of bad and repetitive.
I was thinking whether it could be shorten? Currently the script holds 4000+ lines.
http://justpaste.it/5t3n
(side reminder, the script works fine without any issues, currently I'm just exploring methods to reduce the script size if possible)
Share this post
Link to post
Share on other sites