SRL Archive - OSR Help

Need help urgently with OptionsExist


mika

2012-04-20 19:31:20

is this correct:
if OptionsExist('ank',True) then

it seems to be. What i need is to check if there is an option of bank when i right click and NPC but my script wont compile because of this.

YoHoJo

2012-04-20 19:34:06

What compile error are you getting?
Actually….
When you look up the function, the first parameter needs to be a TStringArray.

So you would need to make it

if OptionsExist(['ank'],True) then

An array is like a list of stuff.

So you could even do like

if OptionsExist(['Bank', 'ank' 'nk'], True) then

But just 'ank' is fine/faster (by a few milliseconds)

mika

2012-04-20 19:40:55

thank you

Shatterhand

2012-04-21 00:46:12

From: YoHoJo

if OptionsExist(['Bank', 'ank' 'nk'], True) then
But just 'ank' is fine/faster (by a few milliseconds)

Why is it faster? If it finds the first word, the rest wont be compiled. Am I wrong? (or you mean its faster to get false result?)

Runaway

2012-04-21 01:14:24

From: hunt3rx3
Why is it faster? If it finds the first word, the rest wont be compiled. Am I wrong? (or you mean its faster to get false result?)


It looks like the inputted data gets handled before any searching is done, so he must be referring to the time it takes to load the array and then retrieve it's length.

YoHoJo

2012-04-21 01:21:00

Honestly the difference is just a few ms if any, it's negligible.

I'd say 'ank' will work all the time, to to be safer you can add more parts of it if you want.