Jump to content
  • 0

Need Help With Dynamic Menu


BloodFang

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  11/27/12
  • Last Seen:  

Hey guys, Im making a script for a SQL based blacksmith using dynamic menus from sql query made arrays (I put all the blacksmith recipies in there) but Im having a bit of trouble with my dynamic menu. I browsed the forum a bit and found this:

set @menu$,"";
for ( set .@i,0, .@i< getarraysize(@array); set .@i,.@i + 1)
	set @menu$,@menu$ + @array[.@i] +":";
select @menu$-1;

I plugged in all my variables and my array and everything complies fine with I reload the scripts but when I execute the script itself I get:

[Error]: script:op_2: invalid data for operator C_SUB
[Debug]: Data: string value="Slayer:Bastard Sword:"
[Debug]: Data: number value=1

I think its because its trying to do math with strings but I have no idea how to fix it and I really need the dynamic menu. Can anyone point me in the right direction? ANY help would be much appreciated, thanks.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  247
  • Reputation:   207
  • Joined:  10/23/12
  • Last Seen:  

@array[.@i] needs to be a string array. @array$[.@i]

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

@array[.@i] needs to be a string array. @array$[.@i]

No.

The error is here:

select @menu$-1;

It should be

set .@val, select(@menu$)-1;

Or:

select @menu$;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  32
  • Topics Per Day:  0.01
  • Content Count:  247
  • Reputation:   207
  • Joined:  10/23/12
  • Last Seen:  

Oh whoops. My bad. Totally missed the parenthesis.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  11/27/12
  • Last Seen:  

@array[.@i] needs to be a string array. @array$[.@i]

No.

The error is here:

select @menu$-1;

It should be

set .@val, select(@menu$)-1;

Or:

select @menu$;

Thanks Key, your the best lol

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...