Author Topic: Comparing a local race string  (Read 518 times)

Legacy_Badwater

  • Full Member
  • ***
  • Posts: 220
  • Karma: +0/-0
Comparing a local race string
« Reply #15 on: August 24, 2011, 10:12:27 am »


               Thanks to everyone for their replies. I don't learn anything if I don't know my options. And I have learned something from every reply.

Thanks for your answer, Rolo - that's the one that has the most options for me. But again, thanks to all of you, because I learned something today....*South Park segue*
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Comparing a local race string
« Reply #16 on: August 24, 2011, 05:19:11 pm »


               <wishing he was...>

NP :-)  That's how I learn, too

I am one of the oldest scripters on this board (well, on the old Interplay board...), but, thanks to years wandering in the desert, one of the greenest noobs :-P An awkward dichotomy.

Still, I'm having a lot of fun =) And I like Lightfoot8's algo for something else I was frustrated by... so, yeah, I learned something too.

@Lightfoot8 Is "return (boolean condition);" more efficient cpu-wise than "if (bCondition) return TRUE; return FALSE;"? Or, to be clearer, do they compile differently? Does the second method add an extra branch?

<...still young enough to blush>
               
               

               


                     Modifié par Rolo Kipp, 24 août 2011 - 04:20 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Comparing a local race string
« Reply #17 on: August 24, 2011, 11:22:34 pm »


               Yes it is more efficent CPU wize.
No they do not compile to the same thing.
Yes it adds another branch. along with having to move the value of the TRUE/FALSE constant onto the stack and move it around.

EDIT: you can always look at the compiled code for your scripts with nwnexplorer. 
If you want to know what all the codes mean they are listed at the following off site link.

http://www.nynaeve.n...tation/ncs.html
               
               

               


                     Modifié par Lightfoot8, 24 août 2011 - 10:24 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Comparing a local race string
« Reply #18 on: August 24, 2011, 11:49:22 pm »


               <grins slyly...>

Lightfoot8 wrote...

Yes it is more efficent CPU wize.
No they do not compile to the same thing.
Yes it adds another branch. along with having to move the value of the TRUE/FALSE constant onto the stack and move it around.

Thank you! It is true in C, but I've been told over and over that (though based off C) NWScript is *not* C. :-/
(Mostly when we were arguing with Don Moar for arrays...)

EDIT: you can always look at the compiled code for your scripts with nwnexplorer. 

An old fox like me? When cool cats like you are so willing (and effective!) at helping? ;-)

(translation: Didn't know that :-) Cool. Sometimes I get on a real OCD, minimalist coding kick... I'll use that then)

<...and slips out of the coop)
               
               

               


                     Modifié par Rolo Kipp, 24 août 2011 - 10:50 .