Raised This Month: $ Target: $400
 0% 

Any way to optimise this?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 03-12-2013 , 16:16   Any way to optimise this?
Reply With Quote #1

Hey guys. So i have a code, first of all, i get the champions name, then check whether a user has this champion and apply some privileges to him. It looks like this :
Code:
new champions_name[64]; new cclass = get_champion(id) get_class_name(cclass, champions_name, 63) // Then i do tonns of checks if (equali(champions_name, "Podarok") //bla bla bla
I do like 15-20 checks- it works fine , but im pretty sure there must be a way in optimising this code.
Podarok is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-12-2013 , 16:18   Re: Any way to optimise this?
Reply With Quote #2

With the output you gave alone, it is fine
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Podarok
BANNED
Join Date: Jan 2011
Location: Narnia
Old 03-12-2013 , 16:20   Re: Any way to optimise this?
Reply With Quote #3

Okay. Thanks. Nothing then.
Podarok is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 03-12-2013 , 17:53   Re: Any way to optimise this?
Reply With Quote #4

you could always use switch(champions_name), just saying.
EDUTz is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-12-2013 , 17:57   Re: Any way to optimise this?
Reply With Quote #5

Quote:
Originally Posted by EDUTz View Post
you could always use switch(champions_name), just saying.
A switch doesn't work on an array
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 03-12-2013 , 18:00   Re: Any way to optimise this?
Reply With Quote #6

crap, i haven't read it all. based on what he posted, he could switch(cclass) but i don't know how he used it.
EDUTz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-12-2013 , 19:49   Re: Any way to optimise this?
Reply With Quote #7

Quote:
Originally Posted by EDUTz View Post
he could switch(cclass) but i don't know how he used it.
That won't help either.
__________________
fysiks is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 03-12-2013 , 20:37   Re: Any way to optimise this?
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
That won't help either.
wrong, it would help.

switch(cclass)
{
case CLASS_IDIOT:

as i said, i don't know what he did there, but just assuming he just did a new class for war3ft, he won't need it.
EDUTz is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-12-2013 , 21:35   Re: Any way to optimise this?
Reply With Quote #9

He asked how to optimize the code he posted. Not to assume the rest of the code and optimize that. For all we know, he is already using a switch on cclass.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-13-2013 , 08:07   Re: Any way to optimise this?
Reply With Quote #10

Quote:
I do like 15-20 checks
I take this as he's copy pasting equali 15-20 times, which is horrible, considering, as EDUTz said, he can just switch through the class ID.
Backstabnoob is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode