TWorkers Userfunction (writing data in a txt file)

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Post Reply
Message
Author
User avatar
cibervagos
Posts: 26
Joined: Sat Apr 12, 2014 10:36 pm
Location: Argentina

TWorkers Userfunction (writing data in a txt file)

#1 Post by cibervagos » Thu Sep 04, 2014 7:17 pm

Hi all! Well, in first place I will apologise for my english. Is not so good. I will apreciate every correction. I dont use translators, so be nice with me :) .

This userfunction store in a file the name of your characters, amount of belts, amount of fusion stones, amount of energy charges, and amount of Phirius tokens when you call the function save_TW().

You can especify a file name or use the file name by default. If the file doesnt exist, will be created (in userfunction folder) (*)

I actually use it to know how much belt or fusion stones I need to send to each character. U can do it manually or made a function to read the file and calculate how much items u need to make yours mana stones. (in the future I will upgrade this userfunction and include that function).

Well, that is all. I hope u find it usefull. Is usefull for me :D


* To specify a file name use save_TW("myname"). For example I use save_TW("Palenque") for my characters in palenque and save_TW("Indigo") for my chars in Indigo. So I have 2 diferent files and I can make the diference betwen servers. (So I dont send belts from Palenque to a character in Indigo :lol: )
Attachments
userfunction_TWorkers.lua
Version 1.02 Fix erased characters.-
(3.69 KiB) Downloaded 144 times
Last edited by cibervagos on Sun Sep 07, 2014 3:05 pm, edited 3 times in total.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: My First Userfunction

#2 Post by rock5 » Thu Sep 04, 2014 11:40 pm

Good for you.

You should change the name of the topic to something more descriptive or include the name of the userfunction or the function name. It will help with searching. Just edit the first post and change the name.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
cibervagos
Posts: 26
Joined: Sat Apr 12, 2014 10:36 pm
Location: Argentina

Re: TWorkers Userfunction (writing data in a txt file)

#3 Post by cibervagos » Sun Sep 07, 2014 11:16 am

Well, I fix a little issue. Now the userfunction read the data in order and save it in order.

If u need see what userfunction read and save u can add a true after file name. Example: save_TW("file_name", true).
Attachments
userfunction_TWorkers.lua
Version 1.02 Fix Erased characters.
(3.69 KiB) Downloaded 168 times

User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: TWorkers Userfunction (writing data in a txt file)

#4 Post by Lamkefyned » Sun Sep 21, 2014 9:37 am

This Userfunction my not work for me ...
Sin título.jpg
This is the error that I get to put it, if I remove it I do not get any error
If you think something is right just because everyone else believes,you're not thinking.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: TWorkers Userfunction (writing data in a txt file)

#5 Post by rock5 » Sun Sep 21, 2014 9:54 am

I'm a bit confused. He included a function called "explode" but it is never used.

The error probably happens because the function "explode" is already part of the bot. So when the bot tries to use explode it uses this version which is not compatible.

Try deleting that function.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Lamkefyned
Posts: 348
Joined: Thu May 23, 2013 11:38 am
Location: Spain

Re: TWorkers Userfunction (writing data in a txt file)

#6 Post by Lamkefyned » Sun Sep 21, 2014 10:05 am

thank you very much rock5
If you think something is right just because everyone else believes,you're not thinking.

User avatar
cibervagos
Posts: 26
Joined: Sat Apr 12, 2014 10:36 pm
Location: Argentina

Re: TWorkers Userfunction (writing data in a txt file)

#7 Post by cibervagos » Sat Sep 27, 2014 9:37 pm

rock5 wrote:I'm a bit confused. He included a function called "explode" but it is never used.

The error probably happens because the function "explode" is already part of the bot. So when the bot tries to use explode it uses this version which is not compatible.

Try deleting that function.
Sorry for that, I change it in my userfunction but I forgot update the post. I include that function be couse I try to expand the userfunction. In this moment the userfunction can return an array with a list of yours characters name, u can configure a list of character to be ignored for the userfunction, make T5 stones, and many other things. But I have some issues making T5 with the userfunction. When I get the final version working I will update.

What I can do with this userfunction?

I have a character who buy belts and fusion stone. I have a waypoint to buy belts. the bot search in the list how much belts have the first character in the list and send belt to reach at a configurable amunt of belt per character and update the file making a flag to indicate new items in mailbox. After that, do the same with the second character, etc. When finish with the belts, transport the character to varanas and do the same with the fusion stones.

My characters (my littles TWorkers ;) ) read from file if was updated, in this case take the mail (with rock's mail userfunction). Calculate how much T5 can do and calculate if I have enought charges. If not, try to buy charges with phirius tokens (rocks userfunction again) and make the T5 mana stone (with TWorkers userfunction, be couse Fusion addon dont work for me). Then calculate how much T6, T7, and T8 I can do and buy charges if necesary. Make the fusion with Fusion addon (just dont work making T5 becouse recognize lv 81 and lv 86 belts as a T1 item) and send T8 and T9 mana stones to my main character. And send the rest of T5, T6, T7 to the next character listed in the file. Update the file and log the next character.

So I have a completly automatized Tier Workers ;). But I have to solve the fusion issue. Work, but some time get stuck.

Sorry for reply to late. I dont have so much time. But whatever u need... I will try to help. And sorry for my english.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: TWorkers Userfunction (writing data in a txt file)

#8 Post by rock5 » Sun Sep 28, 2014 3:22 am

So your problem is fusion is seeing your items as t1 items? Which items? I'll look into it. And what version of fusion are you using? It was updated recently.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
cibervagos
Posts: 26
Joined: Sat Apr 12, 2014 10:36 pm
Location: Argentina

Re: TWorkers Userfunction (writing data in a txt file)

#9 Post by cibervagos » Mon Sep 29, 2014 6:40 pm

Hi Rock5! I have the last version of Fusion Addon. /script pr(Fusion.Bag:getItem(61):makesTier(1)) return true on 228966,228996 belts (lv 81 belt and lv 86 belt). Obiously /script pr(Fusion.Bag:getItem(61):makesTier(5)) return false. But I think I solved my script problem on my userfunction, so now I can do the fusion with my userfunction. I adding right now new functions. When I finish with them I will update the userfunction. Meaby in a couple of minutes ;)

User avatar
cibervagos
Posts: 26
Joined: Sat Apr 12, 2014 10:36 pm
Location: Argentina

Re: TWorkers Userfunction (writing data in a txt file)

#10 Post by cibervagos » Mon Sep 29, 2014 10:42 pm

Well, now work fine for me. Here is the second version of my userfunction.
I add some function to use

Syntax:

save_TW() -- Save your current character in a txt file. You can especify a file name. Ex: save_TW("mifile")
load_TW() -- Load all Characters data saved in the file. You can especify a file name. Ex: load_TW("mifile")
compraT() -- Buy charges from item shop. Accept a number as a parameter or leave blank for 1 charge. Ex: compraT(5)
compraB() -- Search for NPC and buy belts. can be lv81 belts or lv86. Accept number as a parameter or leave blank to buy all u can store in your bag. Ex: compraB(30)
compraS() -- Search for NPC and buy fusion stones from NPC in varanas. Accept number as a parameter or leave blank to buy all u can store in your bag. Ex: compraS(30)
xBots() -- Return all Characters names listed in the file. You can especify a file name. Ex: xBots("mifile")
xData() --Return current characters data saved in the file. You can especify a file name. Ex: xData("mifile")
elEnvio(name,item,ammount) -- Update data saved of a specific character from the list and make a flag to indicate a new item. SO you can use elEnvio("Playerone",0,12) to update numbers of belt ( 0 = belts, 1 = fusion stone) for character "Playerone". 12 in this case. You can especify a file name. Ex: elEnvio("Playerone",0,12,"mifile") -- After that u can use xData("mifile")[7] to see if the data was updated. Return 0 or 1 (if was updated)
fusion_TW() -- Search for belts and fusion stones and make T5 mana stones. Accept true parameter to make clean T5 mana stones with purified stones. Ex: fusion_TW(true)
WARNING:
After finish with T5 mana stones, the function use the userfunction Fusion_MakeMaxManaStones(); to make higher mana stones. So if you have clean T5 and dirty T5 Fusion_MakeMaxManaStones() will use both.

Please test it. If no problem I will update the first post with this changes.
Attachments
userfunction_TWorkers.lua
TWorkers userfunction v2.01.
Fix explode function
Add buy belts and fusion stones functions
Add List of listed characters
Add fusion function
(14.29 KiB) Downloaded 147 times

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: TWorkers Userfunction (writing data in a txt file)

#11 Post by rock5 » Tue Sep 30, 2014 2:00 am

cibervagos wrote:/script pr(Fusion.Bag:getItem(61):makesTier(1)) return true
Returns false for me and true when using 5. Maybe it's a language thing. Do you ply in English? makesTier uses Level and Quality. Maybe you should check what they print.

Code: Select all

/script i=Fusion.Bag:getItem(61) i:updateTooltipInfo() pr(i.Quality,i.Level)
0   81
I'm using 228966 by the way.

The string that it uses to find the level is

Code: Select all

/script pr(TEXT("TOOLTIP_LIMIT_TEXT") .. ".*" .. TEXT("SYS_LEVEL"))
See if the printed string would match what you see in the tooltip.

Hm... That * might cause a problem. If you have 'Level' anywhere else in your tooltip it will expand the match to that second Level. I should probably change that to - to match the smallest match. So in initialisations.lua I'll change line 105 to

Code: Select all

		Level = TEXT("TOOLTIP_LIMIT_TEXT") .. ".-" .. TEXT("SYS_LEVEL"),
You might want to try this if the Level you printed was wrong.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
cibervagos
Posts: 26
Joined: Sat Apr 12, 2014 10:36 pm
Location: Argentina

Re: TWorkers Userfunction (writing data in a txt file)

#12 Post by cibervagos » Wed Oct 01, 2014 7:09 pm

Hi Rock5! I try

Code: Select all

 Level = TEXT("TOOLTIP_LIMIT_TEXT") .. ".-" .. TEXT("SYS_LEVEL"),
but is the same thing. I try

Code: Select all

/script i=Fusion.Bag:getItem(61) i:updateTooltipInfo() pr(i.Quality,i.Level)
with diferent pieces. Quality is ok. But level always is 0. With any item.
Meaby you are right and is a languaje problem. I play in spanish.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: TWorkers Userfunction (writing data in a txt file)

#13 Post by rock5 » Thu Oct 02, 2014 7:21 am

Ok I figured it out. In Spanish it uses the same word for "tier" as it does for "level". There is a bit of code that says for each line in the tooltip.

Code: Select all

if match "tier" then set tier
else if match "required level" then set level
Because tier and level are the same it always matches the tier first and skips the level.

I just need to figure out how best to deal with it and figure out if there was a reason I had those 2 values tied together with an "if then else".
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: TWorkers Userfunction (writing data in a txt file)

#14 Post by rock5 » Thu Oct 02, 2014 7:36 am

Try this.
item.lua
(6.19 KiB) Downloaded 151 times
It goes in the "interface/addons/fusion/classes" folder.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
cibervagos
Posts: 26
Joined: Sat Apr 12, 2014 10:36 pm
Location: Argentina

Re: TWorkers Userfunction (writing data in a txt file)

#15 Post by cibervagos » Fri Oct 03, 2014 8:12 pm

Ty Rock5!! Work excelent!

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests