Author Topic: extracting, processing and displaying data from a variable  (Read 2847 times)

kaboekieman

  • Jr. Member
  • **
  • Posts: 55
extracting, processing and displaying data from a variable
« on: November 28, 2012, 07:49:28 AM »
hi malkom and the rest of this community. My sample micro dungeon is almost finished. Currently I'm working on the navigation between the text segments inside the flatfile database. The adventure uses only a few HAC cards with as few layouts as possible. text is imported via a flatfile database. I was heavenly inspired by the solar app in the samples section :)

Here lies my question.... I have one long string inside a variable, see this example:

variable text1:
You wake up in a small, damp room. There are exits to the North |2| or to the South |3|. Which route do you take?

For layout purposes I would prefer not to use 'physical' buttons in the layout of the HAC cards (I have instances where users can select 8+ option and this will interfere with my gui in the finished product).

In the variable sample listed above I need to filter out the |2| and |3|, place them inside a local variable and remove the | tokens inside these two navigation variables. The next thing I would like to do is to replace all the |x| portions of the original string with a clickable picture that corresponds with the identifier of the navigation variable (the portion the users will see).

Do you know if this is possible in HAC via HAC code and could you point me/help me out in the right direction?

Thx, Jeroen

Malkom

  • Administrator
  • Sr. Member
  • *****
  • Posts: 287
Re: extracting, processing and displaying data from a variable
« Reply #1 on: November 28, 2012, 11:35:49 AM »
Hi Jeroen

The first part of your question is easy to code but the pictures are a problem as they cannot be inserted into text fields

PART 1:-

Code: [Select]
Local var1,var2,sep,direct1,direct2,idx

Put 'You wake up in a small, damp room. There are exits to the North |2| or to the South |3|. Which route do you take?' into var1

Put '|' into sep

@ --- get directions ---
Put NthChunkFN(var1,sep,2) into direct1
Put NthChunkFN(var1,sep,4) into direct2

@ --- extract text ---
Put NthChunkFN(var1,sep,1) into var2
Append NthChunkFN(var1,sep,3) onto var2
Append NthChunkFN(var1,sep,5) onto var2

Note, there are some spaces left where the directions used to be but you could either format your intial string or trim the extracted parts.



PART 2:-

This really requires a canvas as used in the Solar System demo project because text fields cannot have images placed within them. Canvases are much more flexible than text fields and can have text, images and events.


I'm sorry about the Text Field limitations but hope this helps you.

Malkom



I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

kaboekieman

  • Jr. Member
  • **
  • Posts: 55
Re: extracting, processing and displaying data from a variable
« Reply #2 on: November 28, 2012, 11:57:34 AM »
As usual quick and great respons Malkom :) thx for the clear and detailed response concerning part 1...
As for part 2: I am going to use very long texts in the finished product, so a scrollable transparent text field over a static background image is something I absolutly need. I don't think a transparent scrollable text, including the scrollable small nav. picture over a static background image can be accomplished with a canvas??? If not I wil try to find a suitable place for small nav.  button's in my gui layout.... I will figure it out... I'm sure I can come up with a good design for it (I hope ;))

Thx for your reply malkom :)