Author Topic: Associative array tra result  (Read 1243 times)

Offline Magus_BGforge

  • Planewalker
  • *****
  • Posts: 75
Associative array tra result
« on: September 03, 2017, 09:33:27 PM »
Is there a way to have a tra string as a result in associative array?
I'm trying multi ADD_MAP_NOTE with strings traified.

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 298
  • Gender: Male
Re: Associative array tra result
« Reply #1 on: September 03, 2017, 11:11:40 PM »
I couldn't find this in the docs, but it's listed in the changelog:

Quote
(AT var) is equivalent to @<value of var>

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: Associative array tra result
« Reply #2 on: September 04, 2017, 02:13:08 PM »

Offline Magus_BGforge

  • Planewalker
  • *****
  • Posts: 75
Re: Associative array tra result
« Reply #3 on: September 06, 2017, 01:21:53 AM »
sorry, I don't understand what syntax is supposed to be used. I tried
Code: [Select]
LOAD_TRA ~%MOD_FOLDER%/tra/%LANGUAGE%/map_notes.tra~
ACTION_DEFINE_ASSOCIATIVE_ARRAY notes BEGIN
  ar7200, 2108, 2963 => ( AT 1 )
  ...
END
Code: [Select]
LOAD_TRA ~%MOD_FOLDER%/tra/%LANGUAGE%/map_notes.tra~
ACTION_DEFINE_ASSOCIATIVE_ARRAY notes BEGIN
  ar7200, 2108, 2963 => ( AT "1" )
  ...
END
it doesn't work

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 298
  • Gender: Male
Re: Associative array tra result
« Reply #4 on: September 06, 2017, 04:22:35 AM »
Sorry, you can use it to achieve your goal by assigning integer values in the array, then fetching those values out of the array and using AT on them.

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: Associative array tra result
« Reply #5 on: September 06, 2017, 12:41:09 PM »
(AT foo) is semantically equivalent to @"%foo%" (which is not valid). If the variable foo evaluates to 1, (AT foo) is equivalent to @1.

Offline Magus_BGforge

  • Planewalker
  • *****
  • Posts: 75
Re: Associative array tra result
« Reply #6 on: September 07, 2017, 09:56:58 PM »
Ok, thanks, the following worked
Code: [Select]
ACTION_DEFINE_ASSOCIATIVE_ARRAY notes BEGIN

ar7200, 2108, 2963 => 1
ar7200, 1770, 2481 => 2
...
END

ACTION_PHP_EACH notes AS loc => note_num BEGIN
  OUTER_SPRINT map ~%loc_0%~
  OUTER_SET x = %loc_1%
  OUTER_SET y = %loc_2%
  OUTER_SPRINT note (AT note_num)
END

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: