RPTools.net

Discussion and Support

Skip to content

It is currently Sat Jan 20, 2018 6:17 am 






Reply to topic  [ 6 posts ] 

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7984
Location: Bay Area
 Post subject: [AM] Parsing Raw Data Method
PostPosted: Mon Apr 13, 2015 10:51 pm 
One method to parse raw data is to put that data in to a macro and then read from that macro using Wiki: getMacroCommand(). rawDialog is the name of the macro I put my raw data in. Here's an example:

Code:
<!-- put each line of raw data in to a json array. -->
[
H: EOL = decode("%0A")]
[
H: buttonIndex = getMacroIndexes("rawDialog")]
[
H: descriptions = json.fromList(getMacroCommand(buttonIndex),EOL)]

[
H, foreach(line,descriptions), code: {
   <!-- line has each line of data -->
   ...
}]
 


keywords: amsave parse excel

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon Sep 15, 2008 8:27 am
Posts: 1200
Location: Bristol, UK
 Post subject: Re: [AM] Parsing Raw Data Method
PostPosted: Tue Apr 14, 2015 3:24 am 
Interesting. I imagine that will get hard to do if we add some kind of macro syntax management?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7984
Location: Bay Area
 Post subject: Re: [AM] Parsing Raw Data Method
PostPosted: Tue Apr 14, 2015 3:45 am 
Jagged wrote:
Interesting. I imagine that will get hard to do if we add some kind of macro syntax management?

That would be more about the syntax writing and I hope that would be an optional feature. I really don't like most IDEs especially those that autofill without user input. I really like this method of parsing data because I don't have to worry about special characters, quotes or any other interpolated nonsense due to how the data is entered. You should see all the exceptions I wrote in when trying to read from a textarea. Now I just just copy/paste from most any source like a pdf, website or excel sheet without having to worry about that kind of stuff. This makes building dbs easier, which is what this is only really good for. I wouldn't direct an end user to enter text in to a macro then run the parser. But as a designer or a DM it just makes things much more convenient.

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon Sep 15, 2008 8:27 am
Posts: 1200
Location: Bristol, UK
 Post subject: Re: [AM] Parsing Raw Data Method
PostPosted: Tue Apr 14, 2015 4:20 am 
aliasmask wrote:
I really don't like most IDEs especially those that autofill without user input.


I have a bit of a love/hate relationship with such IDEs. One the one hand I cannot seem to work without it any more and I do like Eclipse's auto complete for many common repetitive tasks, but then they recently added an annoying feature that grabs the cursor and dumps it in the parameter field when I click the [END] button to complete the command line with the semi-colon. :evil:


Top
 Profile  
 
User avatar  Offline
TheBard
 
Joined: Tue Mar 21, 2006 7:26 pm
Posts: 3494
Location: Austin, Tx
 Post subject: Re: [AM] Parsing Raw Data Method
PostPosted: Tue Apr 14, 2015 5:43 pm 
aliasmask wrote:
One method to parse raw data is to put that data in to a macro and then read from that macro using Wiki: getMacroCommand(). rawDialog is the name of the macro I put my raw data in. Here's an example:

Code:
<!-- put each line of raw data in to a json array. -->
[
H: EOL = decode("%0A")]
[
H: buttonIndex = getMacroIndexes("rawDialog")]
[
H: descriptions = json.fromList(getMacroCommand(buttonIndex),EOL)]

[
H, foreach(line,descriptions), code: {
   <!-- line has each line of data -->
   ...
}]
 


That's pretty cool. I guess you could dump a csv in there and parse the contents to fill out tables, json objects and such.

_________________
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7984
Location: Bay Area
 Post subject: Re: [AM] Parsing Raw Data Method
PostPosted: Tue Apr 14, 2015 5:46 pm 
You can do a csv, but you can just copy/paste and use tab character for a delimiter. One thing, you do have to make sure the last column has data in it otherwise the number of tabs will be off for a line.

_________________
Downloads:


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 6 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman