Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Future Improvements (https://forums.graalonline.com/forums/forumdisplay.php?f=10)
-   -   _indexof2 (https://forums.graalonline.com/forums/showthread.php?t=48056)

TribulationStaff 09-18-2003 03:36 AM

_indexof2
 
Make a second version of all the _indexof functions such that they are CaSE seNsItIVE.

Kaimetsu 09-18-2003 09:00 AM

Hmm. I'm sure it has many uses, but I can't seem to think of any...

TribulationStaff 09-18-2003 06:38 PM

Well, the base 64 system Stefan created to deal with storing tiles is case sensitive.

Kaimetsu 09-19-2003 04:30 AM

Quote:

Originally posted by TribulationStaff
Well, the base 64 system Stefan created to deal with storing tiles is case sensitive.
So?

Goboom 09-19-2003 05:02 AM

Quote:

Originally posted by Kaimetsu
Hmm. I'm sure it has many uses, but I can't seem to think of any...
The only thing I can think of is maybe a password system thing or some sort of tile editor type deal, may be wrong but hey I think outside the box.

TribulationStaff 09-19-2003 06:15 AM

Quote:

Originally posted by Kaimetsu


So?

So Jagen asked me to script the conversion for him, and the most efficient way I could think of included indexof to calculate the values of the letters.

-Ramirez- 09-19-2003 06:42 AM

Quote:

Originally posted by Kaimetsu
Hmm. I'm sure it has many uses, but I can't seem to think of any...
It could be quite useful for the upcoming 3.1 that has editboxes and things.

Kaimetsu 09-19-2003 07:08 AM

Quote:

Originally posted by TribulationStaff
So Jagen asked me to script the conversion for him, and the most efficient way I could think of included indexof to calculate the values of the letters.
That's the most efficient way you could think of? Shame on you.

TribulationStaff 09-19-2003 08:01 AM

I am positive indexof is a far cry more efficient that a ton of ifs trying to figure out the decimal value of the letter.

Kaimetsu 09-19-2003 08:13 AM

Quote:

Originally posted by TribulationStaff
I am positive indexof is a far cry more efficient that a ton of ifs trying to figure out the decimal value of the letter.
You wouldn't need 'a ton' if you coded it correctly.

TribulationStaff 09-20-2003 06:37 AM

Still, far better 1 line as opposed to 64 virtually identical if clauses

I can create a string, call it this.values, and arrange all the characters such that their position in the string is their decimal value. However, for this to work right, indexof needs to differentiate between G and g.

Since I don't have access to v3 engine, I can't do a switch statement, which would still be quite a bit longer. So, I am stuck with
NPC Code:

if (strequals(A,#e(blah)))
{
this.decimal+=blah;
}


over and over again

Kaimetsu 09-20-2003 06:47 AM

Quote:

Originally posted by TribulationStaff
Still, far better 1 line as opposed to 64 virtually identical if clauses
I already said you wouldn't need many. Three, perhaps? Maybe four.

Quote:

I can create a string, call it this.values, and arrange all the characters such that their position in the string is their decimal value. However, for this to work right, indexof needs to differentiate between G and g.
Yes, or you could use an efficient method.

TribulationStaff 09-21-2003 03:17 AM

Would you care to explain how three to four ifs could allow me to convert one of 64 characters into their decimal equivalents?

Secondly, how is it at all inefficient to condense those ifs into a single indexof?

Kaimetsu 09-21-2003 03:36 AM

Quote:

Originally posted by TribulationStaff
Would you care to explain how three to four ifs could allow me to convert one of 64 characters into their decimal equivalents?
You'd obviously need a little more code as well; the if-statements would merely divide the characters into ranges. After that, it would be a simple matter of arithmatic.

Quote:

Secondly, how is it at all inefficient to condense those ifs into a single indexof?
Please tell me you're not one of those people who thinks that shortness of script == efficiency.

TribulationStaff 09-21-2003 03:45 AM

So, you admit, you just aren't adding three ifs, you are adding other things. And these "ranges" how would you define them?

As for the length of the script, no, I think it is a lot more efficient to say "where is it located?" than several "is it this? No? Well is it that?"

indexof may start to be a less efficient piece of code when used 10000 times; but, from what I have seen of differences in efficiency at this level of iteration, I doubt that it's going to be a problem.


All times are GMT +2. The time now is 04:53 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.