TWorkers Userfunction (writing data in a txt file)
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Only post additional bot resources here. Please do not ask unrelated questions.
- cibervagos
- Posts: 26
- Joined: Sat Apr 12, 2014 10:36 pm
- Location: Argentina
TWorkers Userfunction (writing data in a txt file)
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
* 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 )
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
* 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 )
- 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.
Re: My First Userfunction
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.
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
- cibervagos
- Posts: 26
- Joined: Sat Apr 12, 2014 10:36 pm
- Location: Argentina
Re: TWorkers Userfunction (writing data in a txt file)
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).
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
- Lamkefyned
- Posts: 348
- Joined: Thu May 23, 2013 11:38 am
- Location: Spain
Re: TWorkers Userfunction (writing data in a txt file)
This Userfunction my not work for me ...
This is the error that I get to put it, if I remove it I do not get any error
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.
Re: TWorkers Userfunction (writing data in a txt file)
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.
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
- Lamkefyned
- Posts: 348
- Joined: Thu May 23, 2013 11:38 am
- Location: Spain
Re: TWorkers Userfunction (writing data in a txt file)
thank you very much rock5
If you think something is right just because everyone else believes,you're not thinking.
- cibervagos
- Posts: 26
- Joined: Sat Apr 12, 2014 10:36 pm
- Location: Argentina
Re: TWorkers Userfunction (writing data in a txt file)
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.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.
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.
Re: TWorkers Userfunction (writing data in a txt file)
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
- cibervagos
- Posts: 26
- Joined: Sat Apr 12, 2014 10:36 pm
- Location: Argentina
Re: TWorkers Userfunction (writing data in a txt file)
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
- cibervagos
- Posts: 26
- Joined: Sat Apr 12, 2014 10:36 pm
- Location: Argentina
Re: TWorkers Userfunction (writing data in a txt file)
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.
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
Re: TWorkers Userfunction (writing data in a txt file)
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.cibervagos wrote:/script pr(Fusion.Bag:getItem(61):makesTier(1)) return true
Code: Select all
/script i=Fusion.Bag:getItem(61) i:updateTooltipInfo() pr(i.Quality,i.Level)
0 81
The string that it uses to find the level is
Code: Select all
/script pr(TEXT("TOOLTIP_LIMIT_TEXT") .. ".*" .. TEXT("SYS_LEVEL"))
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"),
- 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
- cibervagos
- Posts: 26
- Joined: Sat Apr 12, 2014 10:36 pm
- Location: Argentina
Re: TWorkers Userfunction (writing data in a txt file)
Hi Rock5! I try
but is the same thing. I try
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.
Code: Select all
Level = TEXT("TOOLTIP_LIMIT_TEXT") .. ".-" .. TEXT("SYS_LEVEL"),
Code: Select all
/script i=Fusion.Bag:getItem(61) i:updateTooltipInfo() pr(i.Quality,i.Level)
Meaby you are right and is a languaje problem. I play in spanish.
Re: TWorkers Userfunction (writing data in a txt file)
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.
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".
Code: Select all
if match "tier" then set tier
else if match "required level" then set 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
Re: TWorkers Userfunction (writing data in a txt file)
Try this.
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
- cibervagos
- Posts: 26
- Joined: Sat Apr 12, 2014 10:36 pm
- Location: Argentina
Re: TWorkers Userfunction (writing data in a txt file)
Ty Rock5!! Work excelent!
Who is online
Users browsing this forum: No registered users and 5 guests