How to capture and store data (and view it via an alias)?
Re: How to capture and store data (and view it via an alias)?
Thanks for the help. I'll mess with it some more and see if I can get it working.
Re: How to capture and store data (and view it via an alias)?
I still can't get it working...
Here is how I have it set up. I have the code for the two functions in my 'initCustom()' script which gets called when I first log on a character. If I make changes to initCustom I either have to log out and back in or type 'lua initCustom(). I've attached how I have it set up. Was working fine this way. No idea what happened. I can't even get it to capture the data. I'm not getting the cecho I have in the trigger.
Here is how I have it set up. I have the code for the two functions in my 'initCustom()' script which gets called when I first log on a character. If I make changes to initCustom I either have to log out and back in or type 'lua initCustom(). I've attached how I have it set up. Was working fine this way. No idea what happened. I can't even get it to capture the data. I'm not getting the cecho I have in the trigger.
Re: How to capture and store data (and view it via an alias)?
Here is the error I get when something matches my trigger pattern...
Re: How to capture and store data (and view it via an alias)?
That bit of script is missing a critical piece, namely the declaration of the auction_data table. You took it out, and put it as the last line of your trigger. You need that line to be positioned just above the two functions in the script. Assuming it has been this way the whole time, other than when you first got things going, you likely created the auction_data table properly initially, but then when you moved things around, the declaration wasn't happening, so nothing was working the way it should have.
Re: How to capture and store data (and view it via an alias)?
Oh ok. I must have had it correct originally, and then changed it for some reason.
Back to working great!
Back to working great!
Re: How to capture and store data (and view it via an alias)?
Now that it is working great again, how would I go about making another alias (like @aucdatadate) that would display the data in the same table by date then alphabetical item name?
Re: How to capture and store data (and view it via an alias)?
To do that, I would first modify the two major functions that this uses to look like the following:
Alternatively, you could use a more generalizable version of the sorting code in the show_auction_data function like this:
You will notice that this pulls the sorting parts out of the add_auction_data function and moves them into the show_auction_data function, and then allows you to select between two different sorting functions. Now your first display alias should continue working as expected, and you can add another by simply having it call show_auction_data(true).
Alternatively, you could use a more generalizable version of the sorting code in the show_auction_data function like this:
Doing it this way makes changing the sort order as simple as changing what is put into the order table, and would allow you to easily add some option to sort by buyer for example.
Re: How to capture and store data (and view it via an alias)?
Wow! The was a fast reply. So if I use the 2nd option I could type "@aucdata item" based on how I have my alias currently?
I'm getting this error when I copied it into Mudlet...
Lua syntax error:[string "Script: initCustom"]:85: " expected near '['
line 85 is...
if a.[order[1]] ~= b.[order[1]] then return a.[order[1]] < b.[order[1]] end
I'm getting this error when I copied it into Mudlet...
Lua syntax error:[string "Script: initCustom"]:85: " expected near '['
line 85 is...
if a.[order[1]] ~= b.[order[1]] then return a.[order[1]] < b.[order[1]] end
Last edited by Vooku on Thu Jul 26, 2018 8:28 pm, edited 1 time in total.
Re: How to capture and store data (and view it via an alias)?
No, though we could set that up if you wanted it to work that way. As it is, both versions of the function actually produce exactly the same result, the second is just structured to make it easier to add more options later. If you wanted to be able to select several different sorting varieties, you just need to come up with what sorting preferences you want, and we can add them in, using the argument to select which to use, and adjusting your alias to allow for an argument as needed.
Re: How to capture and store data (and view it via an alias)?
If you changed the function to this, then you could select from the table using a text argument, similar to what you mentioned (though modifying the alias still would have to happen obviously, and you would need to add in any additional sort options you wanted, above and beyond the default and "date").
And its code to this: show_auction_data(matches[2])
To make the alias work the way you want, I would change the pattern to this: ^@aucdata(?: \w+)?$
And its code to this: show_auction_data(matches[2])
Last edited by Jor'Mox on Thu Jul 26, 2018 8:36 pm, edited 1 time in total.