Author Topic: Going to write a new script. Need some ideas.  (Read 9156 times)

0 Members and 1 Guest are viewing this topic.

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Going to write a new script. Need some ideas.
« on: December 05, 2008, 05:48:09 PM »
0
It's going to be a script that buys things from npcs.  Most likely resources (Reagents, Boards, Ingots, Arrows, Bolts, Boards, etc).  Just wanted to look for more input to make it as good as possible.  I want it to be able to buy anything from an npc while afk. 

So far these are the following options and a very basic idea on how itll go:

Have a list of items/resources to buy that is customizable (Add/Remove/Save) (Set max buy price)
Have a list of vendors to buy from that is customizable (Add/Remove/Save)
Drop off at bank or house
Recall via chiv or magery
Auto stop on gold spent, time, etc.
Requires giant beetle (Better carrying 1600 stones a trip than a lousy 300 or so)
Support multiple runebooks



1. check for gold and withdraw at least 2000
2. recall to next rune location
3. find vendor from list
4. open vendor
5. scroll through list & add items to cart on your shopping list
6. do a weight calculation on your beetle and the item weight database to determine how much your beetle can still hold
7. buy as much as possible in one deal
8. check beetle weight.  if it's 1600stones or the bank weight specified then bank and return to vendor.  if the vendors were empty recall to next location rather then comming back.
9. repeat over and over until X amount of gold is spent or time passed

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #1 on: December 05, 2008, 09:40:01 PM »
0
I've always like stats.. how about how much you've spent, on what?
also set a limit to how much gold your willing to spend.

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #2 on: December 05, 2008, 10:00:03 PM »
0
Already planned on the limit to how much you've spent.

Statistics would be nice too.  I could throw them into a listbox that get's updated as it drops things off at the bank.

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #3 on: December 06, 2008, 12:42:50 AM »
0
Here's what I came up with so far for the editor.  It's kind of a big but it's only up when you want to edit your lists.

A simple rundown of the screen:

Top right section - A list of items.  This is pretty simple, you have your Item Type, the weight of it, the max price you will ever pay for it, and a description.  These values are extremely important and shouldn't be entered wrong.

Bottom right section - A list of vendors.  Again, simple.  Add the vendors and fill your database.  Since you will have multiple lists that will/can vary greatly, it's important to have a nice selection to choose from.

Left section - This is your shopping list.  You add the items & vendors you created to create "directions" for the script to run by.  Simple enough (In my opinion).


I hope I'm not missing anything (Which I probably am!).  I really don't want to edit the interface for this screen haha.  Any suggestions, possible viewed problems, etc are always welcome, as I would rather make changes sooner than later!

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
omgburgers_shopper1.jpg

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #4 on: December 06, 2008, 08:45:21 AM »
0
How about an inventory max?  lets say for regs I'd like to keep 5k of each reg.. once black pearl reaches 5k the shopper removes BP from the buying list?

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #5 on: December 06, 2008, 07:17:52 PM »
0
How about an inventory max?  lets say for regs I'd like to keep 5k of each reg.. once black pearl reaches 5k the shopper removes BP from the buying list?

That would be cool.  I wonder where I should have that setup in?  Probably not on that screen because it's a fixed "template" list.  Maybe once you set your templates ehn you select it it goes into a list where you type in an amount of what you want stocked to.  From there I guess you can give it the option to get an ADDITIONAL X amount of units, or make your unit EQUAL to X.

Example:  You start w/ 5k black pearl, and tell it to buy an additional 7k to put you at 12k.
Example.  You start w/ 5k black pearl, you tell it to stock up to 15k, so it keep buying until it reaches 15k of it (10k is what it needs to buy).  It then removes it from the list.

If you set limits to what to buy it will auto stop once your spending limits are met, you balance empty, or your shopping list has been filled.

Good ideas people keep them comming!

Offline Ultima

  • Insane Scripter
  • *
  • Posts: 1580
  • Activity:
    0%
  • Reputation Power: 26
  • Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.
  • Gender: Male
  • Respect: +160
  • Referrals: 4
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #6 on: December 06, 2008, 09:50:18 PM »
0
Didn't see blank scrolls on your list there but I'm sure you already have that included.

Gotta keep those Slayer Books and Scrappers flowing...

Sounds pretty intricate to create a shopping list.

I'll help test when the time comes   :)

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #7 on: December 07, 2008, 01:20:15 AM »
0
yeah scrolls is the main reason i'll be writing it lol.

i'll probably release a quick version out that works, then go real hardcore on all the extra options.

reason being is i want a *bleep* pile of slayer sets to sell before the patch hits that's going to get everyone doing those ilshenar champ spawns.

i have no idea how i'm going to do the part where they write how much to stock up on etc.  I'll most likely have to make a custom list of some sort using labels and edit boxes.  reason being is it has to display thier shopping list, and then give them the option to enter how many to buy.  And you really don't what that to be a fixed number that they may need to edit over and over in thier shopping list.  it should really be quickly changeable each time they run it.

i'm thinking where the items are stored in the script, it will save additional information in it like total purchased, last amount to stop at, etc.  so that way when they load it they don't have to set it everytime, but rather it will show thier last settings, and they can choose to change it quickly or keep it the same.

maybe i'm thinking way too much into this or adding way too many options.  who knows.

one thing i promised i wont do is just take out all the general lazyness.  i can probably script it to do anything and everything.  but i should draw a line somewhere before i lose interest and never finish it like most of my scripts lol.

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #8 on: December 07, 2008, 01:22:37 AM »
0
oh i was thinking of an inventory type system to use.  it's going to keep track of how much it bought and crap, but then maybe give users to adjust thier numbers for if they sell a bulk amount of it, buy a bunch, etc.  it's going to be fun!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Going to write a new script. Need some ideas.
« Reply #9 on: December 07, 2008, 01:39:30 AM »
0
That's some crazy script you have brewing there.....  :)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #10 on: December 07, 2008, 02:04:55 AM »
0
Yeah I hope like hell I finish it :/  I would REALLY love to be using it while I'm at work lol.

Right now I'm just working on finishing that screen.  None of it's uo related which is good so it's easy to test.  Right now I'm working on the item type list and getting that done.  From there I should have all my subs needed to finish the other parts of it very quickly.

Hopefully by today maybe I can have this form at least posted up for people to mess around with and/or get a feel for it.  Then I'll slowly start on figureing out how the hell to do the main interface.  I'm not 100% happy with this one, and almost wondering if I should make the menus seperate  for the vendor list, item type list, and shopping list.  But It's kind of useful being all on one screen so you can edit them on the fly and add new things without having to save, go back to main menu, to the other editor, etc. My main thing is confusing people, but it's so easy imo and there will be better help then I ever had, I'm not sure how people won't be able to use it lmao.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Going to write a new script. Need some ideas.
« Reply #11 on: December 07, 2008, 06:24:47 AM »
0
If it will be helpful, you might give my List Handling Subs a try.  They might really simplify your list box handling, especially since I added the tag information along with the display info.

Plus they allow you to save/recall lists from file.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #12 on: December 09, 2008, 01:16:47 AM »
0
I dunno... this is just an idea?

I used TM List Handler
not everything in the code is used, i'm just to lazy to figure out which subs are being used in the handler.
Code: [Select]
gosub TM_CreateList List Newlist1 220 44 121 97 White WindowText %font_arial 8
Menu Show
GoSub ShowEUOMENU1

start:
Set #MenuButton N/A
Loop:
if #MenuButton <> N/A
Goto #MenuButton
Goto Loop
Add:
Menu Get Regreants
gosub Getregname

Goto Start

HALT

sub getregname
if #MenuRes = 1
   Set %Item Black_Pearl
if #MenuRes = 2
   Set %Item Blood_Moss
if #MenuRes = 3
   Set %Item Ginsing
if #MenuRes = 4
   Set %Item NightShade
if #MenuRes = 5
   Set %Item Mandrake_Root
if #MenuRes = 6
   Set %Item Sulpher_Ash
if #MenuRes = 7
   Set %Item Garlic
Menu Get Total
Set %Total #MenuRes
Set %Add_Item %Item , _ , %Total
GoSub AddSpace %Add_Item
gosub TM_AddToList Newlist1 #Result
return

;--------- EasyUO Menu Designer Code Begin ---------
sub showEUOMenu1
;menu Clear
menu Window Title EUOMenu1
menu Window Color BtnFace
menu Window Size 414 230
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Transparent #false
menu Font Align Left
menu Text EUOLabel1 236 28 Shoping List Max
menu Font BGColor Window
menu Combo Create Regreants 28 44 105
menu Combo Add Regreants Black Pearl
menu Combo Add Regreants Blood Moss
menu Combo Add Regreants Ginsing
menu Combo Add Regreants NightShade
menu Combo Add Regreants Mandrake Root
menu Combo Add Regreants Sulpher Ash
menu Combo Add Regreants Garlic
menu Edit Total 140 44 73 Set , #spc , Amount
;menu List Create EUOListBox1 220 44 121 97
menu Font BGColor BtnFace
menu Button Add 140 72 31 17 Add
menu Button Delete 176 72 39 17 Delete
menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------

;=================================================================
; Script Name: TrailMyx's List Handling Subs
; Author: TrailMyx
; Version: 0.20
; Shard OSI / FS: OSI / FS OK
; Revision Date: 3/12/2008
; Purpose: Take the pain out of managing lists
;
; Subroutines included:
;   TM_CreateList - Creates the list
;   TM_DrawList
;   TM_ReDrawList
;   TM_AddToList
;   TM_DeleteAllItemsInList
;   TM_CopyAllItemsInList
;   TM_DeleteIndexedItemInList
;   TM_DeleteExactItemsInList
;   TM_DeleteItemsInList
;   TM_SearchForExactItemInList
;   TM_SearchForItemInList
;   TM_CountExactItemsInList
;   TM_CountItemsInList
;   TM_AlphabetizeList
;
; Requirements:
;
; Locals/Globals:
;   TM_window_list_ , %2 (local)
;
; Special Thanks:
;
;=================================================================
; --- Test and sample code:
;set %font_arial MS , #SPC , Ariel
;gosub showEUOMenu1
;gosub TM_CreateList List Newlist1 10 10 100 100 White WindowText %font_arial 8
;gosub TM_LoadListFromFile c:\testlist.txt ; load a list from file
;gosub TM_ReDrawList Newlist1 ; redraw list
;gosub TM_CreateList List Newlist2 110 10 100 100 White WindowText %font_arial 8
;gosub TM_AddToList Newlist1 alpha
;gosub TM_AddToList Newlist1 gamma
;gosub TM_AddToList Newlist1 beta
;gosub TM_AddToList Newlist1 monkey
;gosub TM_AlphabetizeList Newlist1 >
;gosub TM_AddToList Newlist2 monkey
;gosub TM_DeleteItemsInList Newlist1 1 #TRUE #TRUE
;gosub TM_CopyAllItemsInList Newlist1 Newlist2 #FALSE #TRUE
;gosub TM_SaveListToFile Newlist1 c:\testlist.txt
;stop
;-----------------------------------------------------------------
sub TM_LoadListFromFile
  namespace push
  namespace local LLFF
  set !filename %1
  gosub TM_FileSystem_LoadFile !filename
  namespace pop
return
;-----------------------------------------------------------------
sub TM_SaveListToFile
  namespace push
  namespace local TM_window_list_ , %1
  set !listname %1
  set !filename %2
  gosub TM_FileSystem_CreateFileHandle save_handle
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle listtype
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle listname
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle x1
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle y1
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle x2
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle y2
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle bgcolor
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle txtcolor
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle font
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle fontsize
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle fontstyle
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle draw
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle list_ptr

for !j 0 !list_ptr
  gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle list , !j

gosub TM_FileSystem_SaveFile save_handle !filename
set #RESULT !listname
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_CreateList
  namespace push
  namespace local TM_window_list_ , %2
  namespace clear
  set !listtype %1
  set !listname %2
  set !x1 %3
  set !y1 %4
  set !x2 %5
  set !y2 %6
  set !bgcolor %7
  set !txtcolor %8
  set !font %9
  set !fontsize %10
  if %0 >= 11
    set !fontstyle %11
  else
    set !fontstyle N/A
  set !draw #TRUE

  if NODRAW in !listtype
    set !draw #FALSE

  if List in !listtype
    set !listtype List

  if Combo in !listtype
    set !listtype Combo

  if !draw = #TRUE
    gosub TM_DrawList !listname
  set !list_ptr 0
  namespace pop
return
;-----------------------------------------------------------------
sub TM_DrawList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  menu Font BGColor !bgcolor
  menu Font Color !txtcolor
  menu Font Size !fontsize
  menu Font Name !font
  if !fontstyle = N/A
    menu Font Style
  else
    menu Font Style !fontstyle
  menu !listtype create !listname !x1 !y1 !x2 !y2
  set !end !list_ptr - 1
  if !end >= 0
  {
    for !i 0 !end
      menu !listtype add !listname !list . !i
  }
  set #LPC !temp_LPC
  namespace pop
return
;-----------------------------------------------------------------
sub TM_ReDrawList
  namespace push
  namespace local TM_window_list_ , %1
  menu delete %1
  gosub TM_DrawList %1
  namespace pop
return
;-----------------------------------------------------------------
sub TM_AddToList
  namespace push
  namespace local TM_window_list_ , %1
  set !listname %1
  set !item %2
  set !list . !list_ptr !item
  set !list_ptr !list_ptr + 1
  set #RESULT !list_ptr
  menu !listtype add !listname !item
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_DeleteAllItemsInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !redraw %2
  if !list_ptr >= 0
  {
    for !i 0 !list_ptr
      set !list . !i N/A
    set !list_ptr 0
    if !redraw = #TRUE
      gosub TM_ReDrawList !listname
  }
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_CopyAllItemsInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname1 %1
  set !listname2 %2
  set !append %3
  set !redraw %4
  if !append <> #TRUE
    gosub TM_DeleteAllItemsInList !listname2
  if !list_ptr > 0
  {
    set !end !list_ptr - 1
    for !i 0 !end
      gosub TM_AddToList !listname2 !list . !i
    if !redraw = #TRUE
      gosub TM_ReDrawList !listname2
  }
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_DeleteIndexedItemInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !index %2 - 1
  set !redraw %3
  if !index >= 0
  {
    for !i !index !list_ptr
    {
      set !next !i + 1
      set !list . !i !list . !next
    }
    set !list_ptr !list_ptr - 1
    if !redraw = #TRUE
      gosub TM_ReDrawList !listname
  }
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_DeleteExactItemsInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !item %2
  set !deleteall %3
  set !redraw %4
  set !count 0
  for !j 0 !list_ptr
  {
    if !list . !j = !item
    {
      set !count !count + 1
      for !i !j !list_ptr
      {
        set !next !i + 1
        set !list . !i !list . !next
      }
      set !j !j - 1
      set !list_ptr !list_ptr - 1
      if !deleteall = #FALSE
        break
    }
  }
  if !redraw = #TRUE
    gosub TM_ReDrawList !listname
  set #RESULT !count
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_DeleteItemsInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !item %2
  set !deleteall %3
  set !redraw %4
  set !count 0
  for !j 0 !list_ptr
  {
    if !item in !list . !j
    {
      set !count !count + 1
      for !i !j !list_ptr
      {
        set !next !i + 1
        set !list . !i !list . !next
      }
      set !j !j - 1
      set !list_ptr !list_ptr - 1
      if !deleteall = #FALSE
        break
    }
  }
  if !redraw = #TRUE
    gosub TM_ReDrawList !listname
  set #RESULT !count
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_SearchForExactItemInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !item %2
  set !highlight %3
  for !i 0 !list_ptr
  {
    if !list . !i = !item
    {
      set #RESULT !i + 1
      if !highlight = #TRUE
        menu !listtype select !listname #RESULT
      namespace pop
      return #RESULT
    }
  }
  set #LPC !temp_LPC
  namespace pop
return #FALSE
;-----------------------------------------------------------------
sub TM_SearchForItemInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !item %2
  set !highlight %3
  for !i 0 !list_ptr
  {
    if !item in !list . !i
    {
      set #RESULT !i + 1
      if !highlight = #TRUE
        menu !listtype select !listname #RESULT
      namespace pop
      return #RESULT
    }
  }
  set #LPC !temp_LPC
  namespace pop
return #FALSE
;-----------------------------------------------------------------
sub TM_CountExactItemsInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !item %2
  set !count 0
  for !i 0 !list_ptr
  {
    if !list . !i = !item
      set !count !count + 1
  }
  set #RESULT !count
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_CountItemsInList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set #LPC 1000
  set !listname %1
  set !item %2
  set !count 0
  for !i 0 !list_ptr
  {
    if !item in !list . !i
      set !count !count + 1
  }
  set #RESULT !count
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_AlphabetizeList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp_LPC #LPC
  set !eval %2
  set #LPC 1000
  set !listname %1
  if !list_ptr < 2
    goto AlphabetizeList_skip
  set !end !list_ptr - 1
  for !i 0 !end
  {
    set !next !i + 1
    if !i = !end
      break
    for !j !next !end
    {
      set !iptr 0
      str len !list . !i
      set !ilen #STRRES
      set !jptr 0
      str len !list . !j
      set !jlen #STRRES
      set !len !ilen
      if !ilen > !jlen
         set !len !jlen
      for !p 1 !len
      {
        str mid !list . !i !p 1
        gosub TM_EvaluateCharacter #STRRES
        set !c1 #RESULT
        str mid !list . !j !p 1
        gosub TM_EvaluateCharacter #STRRES
        set !c2 #RESULT
        if !c1 = !c2
          continue
        if !c1 !eval !c2
        {
          set !temp !list . !i
          set !list . !i !list . !j
          set !list . !j !temp
        }
        break
      }
    }
  }

AlphabetizeList_skip:
  set #LPC !temp_LPC
  namespace pop
return #RESULT
;-----------------------------------------------------------------
sub TM_EvaluateCharacter
  namespace push
  namespace local EVAL
  set !char %1
  set !string ! , "#$%&'()*+,- , #DOT , /0123456789: , #SMC , <=>?@[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
  str pos !string !char
  namespace pop
return #STRRES

;================================ File System ==================================
;-------------------------------------------------------------------------------
; %1 - Name of file handle name to create
sub TM_FileSystem_CreateFileHandle
  namespace push
  namespace local TM_FileSystem
  set !ptr %1 , _ptr ; {userhandle}_ptr
  set ! . !ptr 0 ; !{userhandle}_ptr (actual pointer)
  set !handle ! . !ptr
  set !handle %1 , !handle
  set ! . !handle ; assume new variable
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 = namespace location (local, global)
; %2 = namespace name
; %3 = file handle name
; %4 = variable name
sub TM_FileSystem_SaveVariable
  namespace push
  namespace local TM_FileSystem
  set !ns_loc %1
  set !ns_name %2
  set !handle %3
  set !var %4
  set !sep 
  set !temp_LPC #LPC
  set #LPC 1000
  if !handle = handle
    set !handle __ , handle
  set !ptr !handle , _ptr ; {userhandle}_ptr
  set !handle_copy !handle
  if ! . !ptr = N/A
  {
    set ! . !ptr 0 ; !{userhandle}_ptr (actual pointer)
    set !handle_copy ! . !ptr
    set !handle_copy !handle , !handle_copy
    set ! . !handle_copy ; assume new variable
  }
  set !handle_copy ! . !ptr
  set !handle_copy !handle , !handle_copy
  if !ns_loc = local && !ns_name = std
    set !value % . !var
  else
  {
    namespace copy !var from !ns_loc !ns_name
    set !value ! . !var
  }
  gosub AddUnderscore !value ; must not have spaces in stored variables!!!
  set ! . !handle_copy ! . !handle_copy , !ns_loc , !sep , !ns_name , !sep , !var , !sep , #RESULT , !sep
  str len ! . !handle_copy
  if #STRRES > 2000
  {
    set !len #STRRES
    str left ! . !handle_copy 2000
    set !temp #STRRES
    str del ! . !handle_copy 1 2000
    set ! . !handle_copy !temp
    set ! . !ptr ! . !ptr + 1
    set !handle_copy ! . !ptr
    set !handle_copy !handle , !handle_copy
    set ! . !handle_copy #STRRES
  }
  set !value
  set !temp
  set #LPC !temp_LPC
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 = namespace location (local, global)
; %2 = namespace name
; %3 = file handle name
; %4 = array name
; %5 = starting index
; %6 = ending index
sub TM_FileSystem_SaveArray
  namespace push
  namespace local TM_FileSystem
  set !temp_LPC #LPC
  set #LPC 10000
  set !ns_loc %1
  set !ns_name %2
  set !handle %3
  set !var %4
  set !start_index %5
  set !end_index %6
  set !sep 
  if !handle = handle
    set !handle __ , handle
  set !ptr !handle , _ptr ; {userhandle}_ptr
  set !handle_copy !handle
  if ! . !ptr = N/A
  {
    set ! . !ptr 0 ; !{userhandle}_ptr (actual pointer)
    set !handle_copy ! . !ptr
    set !handle_copy !handle , !handle_copy
    set ! . !handle_copy ; assume new variable
  }
  set !handle_copy ! . !ptr
  set !handle_copy !handle , !handle_copy
  for !i !start_index !end_index
  {
    if !ns_loc = local && !ns_name = std
    {
      set !newvar !var , !i
      set !value % . !newvar
    }
    else
    {
      set !newvar !var , !i
      namespace copy !newvar from !ns_loc !ns_name
      set !value ! . !newvar
    }
    gosub AddUnderscore !value ; must not have spaces in stored variables!!!
    set ! . !handle_copy ! . !handle_copy , !ns_loc , !sep , !ns_name , !sep , !newvar , !sep , #RESULT , !sep
    str len ! . !handle_copy
    if #STRRES > 2000
    {
      set !len #STRRES
      str left ! . !handle_copy 2000
      set !temp #STRRES
      str del ! . !handle_copy 1 2000
      set ! . !handle_copy !temp
      set ! . !ptr ! . !ptr + 1
      set !handle_copy ! . !ptr
      set !handle_copy !handle , !handle_copy
      set ! . !handle_copy #STRRES
    }
  }
  set !value
  set !temp
  set #LPC !temp_LPC
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 = file handle name
; %2 = file name
sub TM_FileSystem_SaveFile
  namespace push
  namespace local TM_FileSystem
  set !temp_LPC #LPC
  set #LPC 10000
  set !LINE_LENGTH 2000 ; near DOS maximum
  set !handle %1
  set !filename %2
  if !handle = handle
    set !handle __ , handle
  set !ptr !handle , _ptr ; {userhandle}_ptr
  for !i 0 ! . !ptr
  {
    set !handle_copy !handle , !i
    set !str ! . !handle_copy
    if !i = 0
      execute cmd.exe /c echo set , #spc , ! , fileout , !i ,  #spc , !str > !filename
    else
      execute cmd.exe /c echo set , #spc , ! , fileout , !i , #spc , !str >> !filename
  }
  set #LPC !temp_LPC
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 - file line variable
sub TM_ReadVariables
  set !temp %1
  set !fileoutindex 0
  set !fileout !fileout0
  TM_ReadVariables_loop1:
    gosub ReadItem ns_loc
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1
    gosub ReadItem ns_name
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1
    gosub ReadItem var
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1
    gosub ReadItem value
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1

    if !ns_loc in local_LOCAL && !ns_name in std_STD
      set % . !var !value
    else
    {
      set ! . !var !value
      namespace copy !var to !ns_loc !ns_name
    }
    goto TM_ReadVariables_loop1

  TM_ReadVariables_skip1:
return
;-------------------------------------------------------------------------------
; Passes %fileout(n) as local, #RESULT
sub ReadItem
  str pos !fileout 
  if #STRRES = 0
  {
    set !fileoutindex !fileoutindex + 1
    if !fileout . !fileoutindex <> N/A
    {
      set !fileout !fileout , !fileout . !fileoutindex
      str pos !fileout 
    }
    else
    {
      return #TRUE
    }
  }
  set !len #STRRES - 1
  str left !fileout !len
  set ! . %1 #STRRES
  set !len !len + 1
  str del !fileout 1 !len
  set !fileout #STRRES
return #FALSE
;-------------------------------------------------------------------------------
; %2 - file name
sub TM_FileSystem_LoadFile
  namespace push
  namespace local TM_FileSystem
  set !lpc #LPC
  set #LPC 10000
  set !filename %1

  for !i 0 1000
    set !fileout . !i N/A

  call !filename
  if !fileout0 = N/A
  {
    set #LPC !lpc
    namespace pop
    set !TM_Function_found #TRUE
    return #TRUE ; error
  }

  set !index 0
  gosub TM_ReadVariables ; assumes namespace TM_FileSystem

  set #LPC !lpc
  namespace pop
  set !TM_Function_found #TRUE
return #FALSE
;-------------------------------------------------------------------------------
; %1 - string to mung
sub AddUnderscore
  namespace push
  namespace local AU
  set !tempstring %1
  AddUnderscore_loop1:
    str pos !tempstring #SPC
    if #STRRES <> 0
    {
      set !val #STRRES - 1
      str left !tempstring !val
      set !left #STRRES
      set !val !val + 1
      str del !tempstring 1 !val
      set !tempstring !left , _ , #STRRES
      goto AddUnderscore_loop1
    }
  set #RESULT !tempstring
  namespace pop
return #RESULT
;-------------------------------------------------------------------------------
; %1 - string to mung
sub AddSpace
  namespace push
  namespace local AS
  set !tempstring %1
  AddSpace_loop1:
    str pos !tempstring _
    if #STRRES <> 0
    {
      set !val #STRRES - 1
      str left !tempstring !val
      set !left #STRRES
      set !val !val + 1
      str del !tempstring 1 !val
      set !tempstring !left , #SPC , #STRRES
      goto AddSpace_loop1
    }
  set #RESULT !tempstring
  namespace pop
return #RESULT
; For test code:
;-----------------------------------------------------------------

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Menu Shopper.JPG
« Last Edit: December 09, 2008, 01:18:31 AM by Khameleon »

Offline OMGBurgersTopic starter

  • Hero Member
  • *
  • Posts: 800
  • Activity:
    0%
  • Reputation Power: 7
  • OMGBurgers has no influence.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #13 on: December 09, 2008, 01:20:33 AM »
0
This is what I have so far.  So far everything works but the saving/loading of the completed shopping lists.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
omgburgers_shopper.txt

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Going to write a new script. Need some ideas.
« Reply #14 on: December 09, 2008, 01:22:36 AM »
0
yay! first downloader/beta tester!

Tags: