Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion Goto page Previous  1, 2
Sylvanoes Posted: Sun Feb 02, 2003 6:43 pm
Capturing Data
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Thu Feb 06, 2003 10:59 pm   
 
ok, i think we might have been going about this the wrong way. string lists just weren't designed to work like arrays of database variables. thats what the database is for, hehe, and i should have known better than to try a cram all that previous code together. So here is a solution that uses the database:

click the database button and create a new database. It needs to have the following fields:
Name as text
lowprice as number
lowplanet as text
highprice as number
highplanet as text

one you have that done, leave the database open, and add the three following triggers to your settings.

#TRIGGER {Planet: (*)} {planet = {%1}} "getplanetdata"
#TRIGGER {(%w)*~( Price per unit: (%x) ~)} {#if (%find( %1, All)) {#var oldrec %dbget( %find( %1, All));#var price %eval( 100*%2);#if (@price < @oldrec.lowprice) {oldrec.lowprice = @price;oldrec.lowplanet = @planet;#dbput %find( %1, All) @oldrec} {#if (@price > @oldrec.highprice) {oldrec.highprice = @price;oldrec.highplanet = @planet;#dbput %find( %1, All) @oldrec}}} {#var newrec "";#addkey newrec name %1;#addkey newrec lowprice %eval( 100*%2);#addkey newrec lowplanet @planet;#addkey newrec highprice %eval( 100*%2);#addkey newrec highplanet @planet;#new All @newrec}} "getplanetdata"
#TRIGGER {--Planet Data-} {#t+ getplanetdata}


run your sales alias, and then click back to the database. You should see it nicely filled in with all the appropiate data. After that you can write a quick alias to do some #loopdb or comparable to figure out where the best profit margin lies.

--------

moon.icebound.net:9000
Reply with quote
Sylvanoes
Beginner


Joined: 30 Jan 2003
Posts: 22
Location: USA

PostPosted: Fri Feb 07, 2003 1:22 am   
 
I am assuming that I should delete the previous information? Meaning all the previously used code.
Reply with quote
Sylvanoes
Beginner


Joined: 30 Jan 2003
Posts: 22
Location: USA

PostPosted: Fri Feb 07, 2003 1:45 am   
 
Of all the attempts to nail this down, I like this one the best. But again, it broke. But this time it broke so horrendously, I had to close down zMUD by using CTRL ALT DEL, and ending zMUD. I was stuck in an access violation loop. I closed down one, and another would open. The records each time I ran my SALES alias, would keep on piling up, after running it 3 times I had well over 400 records. If I could just keep it to a set amount of items, (records) and update the records, each time I ran the SALES alias, I would say it works perfectly.
Being able to just glance at the list, and see a specific type of goods, and the high and low, is just what I was wanting. I am going to attempt to run it once again, but this time I will capture the data as an image and post it, so that you can see what I am talking about. Again, I sincerely thank you. Your efforts are most appreciated. I wouldn't have even known where to begin with this project. The only thing I have is an idea that you are manifesting. THANK YOU!
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Fri Feb 07, 2003 2:16 am   
 
Thats funny because i tested it with both sets of the planet data you posted, and it worked ok. What version of zmud are you using? Kindly activate the debugger, run the script step by step, and then let me know which instruction is causing the access violation.

--------

moon.icebound.net:9000
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Feb 07, 2003 3:43 am   
 
This should work. I've tested it, repeatedly, as best I can. I provided another set of display aliases at the end, they should provide a more useful display. After doing sales, just type bestroutes. If you decide to continue using it, it would probably be helpful to shorten the name.

#TRIGGER {Planet: (*)} {planetlow = {%1}} "getlowprices"
#TRIGGER {(%w)*~( Price per unit: (%d).(%d) ~)} {#MATH templow ((%2 * 100) + %3);#IF (%ismember( %1, @lowlist)) {#IF (@templow < %db( @%1low, price)) {#VARIABLE %1low "";#ADDKEY %1low {price=@templow|planet=@planetlow}}} {#ADDITEM lowlist "%1";#VARIABLE %1low "";#ADDKEY %1low {price=@templow|planet=@planetlow}}} "getlowprices"
#ALIAS lowprices {#FORALL @lowlist {showlow %{i}}}
#ALIAS showlow {#SHOW lowest price for %1: %expanddb( @{%1low}, " on the ", ": ")}
#TRIGGER {--Planet Data-} {#T+ getlowprices}
#TRIGGER {Planet: (*)} {planet = {%1}} "getprices"
#TRIGGER {(%w)*~( Price per unit: (%d).(%d) ~)} {#MATH temp ((%2 * 100) + %3);#IF (%ismember( %1, @profitlist)) {#IF (@temp > %db( @%1, price)) {#VARIABLE %1 "";#ADDKEY %1 {price=@temp|planet=@planet}}} {#ADDITEM profitlist "%1";#VARIABLE %1 "";#ADDKEY %1 {price=@temp|planet=@planet}}} "getprices"
#ALIAS bestprices {#FORALL @profitlist {showgood %i}}
#ALIAS showgood {#SHOW Best price for %1: %expanddb( @{%1}, " on the ", ": ")}
#TRIGGER {--Planet Data} {#T+ getprices}
#AL sales {#FORALL @lowlist {#VAR temp1 %{i}low;#UNVAR @temp1};#UNVAR lowlist;#FORALL @profitlist {#VAR temp2 %{i};#UNVAR @temp2};#UNVAR profitlist;Showplanet Byss resources;Showplanet Coruscant resources;Showplanet Yavin resources;Showplanet Corellia resources;Showplanet Ryloth resources;Showplanet Gamorr resources;Showplanet Tatooine resources;Showplanet Kashyyyk resources;Showplanet Wroona resources;Showplanet Roche resources;Showplanet 'Nal hutta' resources;showplanet 'Nim Drovis' resources;Showplanet 'Ord Mantell' resources}
#AL bestroutes {#FORALL @lowlist {showbest %{i}}}
#AL showbest {#SHOW lowest price for %1: %expanddb( @{%1low}, " on the ", ": ");#SHOW Best price for %1: %expanddb( @{%1}, " on the ", ": ");#CR}


A database still might be better (you could use the %max and %min functions) if you or Emit want to continue working on one.

LightBulb
Advanced Member
Reply with quote
Sylvanoes
Beginner


Joined: 30 Jan 2003
Posts: 22
Location: USA

PostPosted: Fri Feb 07, 2003 10:46 am   
 
PERFETCION!! NO COMPLAINTS!! WORKS LIKE A CHARM!!

I did make it shorter, but not the way that you were thinking I was going to. I made 3 macros, F2, F3, F4. Gee, I wonder what I tied those keys to? Thanks again, EVERYONE! Your the greatest. Wouldn't have been able to do it without you both.

If you want to see the extent of scripting, just ask, and I will post it where you both can easily find it. Its a work in progress since LOTJ uses 12 different classes simultaneously, each with different max levels dependant upon the race you choose. I haven't been able to flush out all the class information, but I have just about nailed down Engineering and Piloting. Its only taken a couple of years. LOL

mud.archsysinc.com 5555

Check it out!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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 vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net