Page 1 of 4
Tier Stone Production: 2 Scripts to Rule them All
Posted: Fri Jan 25, 2013 3:08 am
by Eggman1414
See the updated thread in the Waypoints thread
http://www.solarstrike.net/phpBB3/viewt ... =27&t=5472
As Rock5 has explained on the last page here. The buyfromitemshop userfunction is server dependent
-- WARNING! GUIDs are unique per server. GUIDs given by other users might be wrong for your
-- server. So it's important to get your own GUIDs using the instructions below.
please check here for what you need to do, if you encounter a problem:
http://www.solarstrike.net/phpBB3/viewt ... =27&t=3039
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 3:34 am
by lisa
Eggman1414 wrote:*As a note*This code does not do the charges for some reason. There is no error in rombot. just skips it. It seems to just skip right over it and log into the next character.
you created a function to do the charges but the function itself is never called.
You can either have the code not as a function, so delete the
function charges()
and also the
end
for that, or you can simply just call the function before the relog() like this
charges()
relog()
--=== ===--
you have
amountToBuy = phirCoins / 100
what if you don't have exactly 100 coins, so you have 150, amountToBuy will be 1.5, so when you -1 it will never be 0 and you will never leave the loop, maybe check if it is less than 1,
until 1 > amountToBuy
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 3:53 am
by rock5
Looks good. The reason it doesn't buy charges is because
creates the function, it doesn't run it. So either you just run the code instead, or move the function to the onload and then run it at the waypoint with
To keep it simple I would create another waypoint file that checks your charges, goes to the mailbox to get it's mail, fuses, sends and then returns to the daily npc before loading the next character. That way if you don't want to run the fusing every day, you can just run the dailies. Then when you want to fuse, you run your buyer/sender script that sends the belts and fusion stones, then run the fusing script. There probably will be an issue trying to figure out the right number of items to send to the fusers.
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 4:01 am
by lisa
Changed a couple of things, untested.
password function at top to help deal with different passes for different accounts, trying not to make the passwords a global of course
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
--=== can add code here to deal with different accounts with different passes ===--
--=== trying not to have a global variable with your password ===--
function buycharges()
BuyFromItemShop(896, "seconday password")
end
questEndNpcID1 = 112794
questName1 = "Helping Them Grow"
function relog()
SetCharList({
{account=2 , chars= {2,3,4,5,6,7,8}},
{account=54 , chars= {1,2,3,4,5,7,8}},
{account=55 , chars= {1,2,3,4,5,6,7,8}},
})
LoginNextChar()
yrest(3000)
player:update()
loadProfile()
loadPaths("Daily.xml");
end
</onLoad>
<!-- # 1 --><waypoint x="31847" z="4592" tag ="Main">
local queststate = getQuestStatus(questName1);
if queststate == "complete" then
player:target_NPC(questEndNpcID1);
CompleteQuestByName(questName1);
yrest(300);
end
local dqCount, dqPerDay = RoMScript("Daily_count()");
if dqPerDay == dqCount then
phirCoins = inventory:itemTotalCount(203038)
print("We have "..phirCoins.." phirius coins")
amountToBuy = phirCoins / 100
print("trying to buy "..amountToBuy.." 10x arcane transmutor charges packs")
repeat
buycharges()
yrest(1000);
amountToBuy = amountToBuy - 1
inventory:useItem(202928);
yrest(10);
print("Using 10x arcane transmutor pack")
until 1 > amountToBuy
relog()
else
player:target_NPC(questEndNpcID1);
AcceptQuestByName(questName1,questEndNpcID1);
yrest(300);
end
</waypoint>
<!-- # 3 --><waypoint x="31860" z="4646" y="9"> </waypoint>
<!-- # 2 --><waypoint x="31742" z="5070" y="-11"> </waypoint>
<!-- # 1 --><waypoint x="31416" z="5715" y="-33" tag = "Item1">
queststate = getQuestStatus(questName1)
if queststate == "incomplete" then
player:target_Object(112976,300);
yrest(2500);
__WPL:setWaypointIndex(__WPL:findWaypointTag("Item1"));
end
</waypoint>
<!-- # 1 --><waypoint x="31416" z="5715" y="-33"> </waypoint>
<!-- # 2 --><waypoint x="31742" z="5070" y="-11"> </waypoint>
<!-- # 3 --><waypoint x="31860" z="4646" y="9"> </waypoint>
<!-- # 4 --><waypoint x="31847" z="4583" y="9"> </waypoint>
</waypoints>
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 4:18 am
by Jandrana
And as a separate script: I would like to be able to run 1 script that will buy 10x excellent belts and send them to each character.
I will a attach two files, that you can use as an example for your request.
#1 - will buy belts in Limo desert and send them to a second char - requires rocks userfunction for UMM and lisas userfunction for party monitor
#2 - a user function with various helper functions also required by the buybelts script
(initially designed helping to cleanup bags after running mini games, but now I put more and more general useful functions there)
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 4:41 am
by rock5
I've never used checkeventparty but wouldn't you want to send the belt to the one who messaged you?
Code: Select all
repeat
yrest(1000)
msg, recipient = checkeventparty("belts", "ready");
until msg
So sendBelts sends to the right person.
Cleanup functions are useful but I don't think they are relevant to this topic. An elf daily fuser would just have coins, t4 items, fusion stones and mana stones in it's inventory. It shouldn't be accumulating any other items.
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 5:13 am
by Jandrana
rock5 wrote:I've never used checkeventparty but wouldn't you want to send the belt to the one who messaged you?
Code: Select all
repeat
yrest(1000)
msg, recipient = checkeventparty("belts", "ready");
until msg
So sendBelts sends to the right person.
Yes, of course I'd like to send the belt to the char that messaged me.
I copied the usage from some other script, if I remember correctly.
As far as I understood the "checkeventparty(_name, _msg)" function, the first parameter is a kind of "tag" to identify
different event monitors. The second is the key word that you are waiting for.
It worked for me, maybe by accident
I just mentioned the cleanup stuff, I somebody was looking at the general helper user function file.
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 5:30 am
by rock5
I just had a look at those functions. I looks like you are supposed to start monitoring party messages by typing
You were lucky that it still started the way you wrote it because the logic in the function basically says, "if "stop" then stop the monitoring
else start the monitoring". So anything besides "stop" starts the monitoring.
checkeventparty doesn't accept any arguments. It returns the message and name of a message or it returns nil. So if you want to use the name you have to use
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 5:36 am
by lisa
I don't know about checkeventparty, maybe it was a userfunction someone(maybe even me) wrote.
I can tell you about
checkEventParty()
and
eventParty()
as it is part of party.lua
call
to start the monitoring
then use
to check for messages.
if you want to stop the monitoring just call
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 6:11 am
by Jandrana
I copied the code from "userfunction_partymonitoring.lua" that I've got from here:
http://www.solarstrike.net/phpBB3/viewt ... monitoring
checkeventparty takes two arguments.
Code: Select all
function checkeventparty(_name, _msg)
repeat
local time, moreToCome, name, msg = EventMonitorCheck(_name, "4,1")
if type(_msg) == "string" then
if msg and name ~= player.Name then
if string.find(string.lower(msg),string.lower(_msg)) then
return true
end
end
elseif type(_msg) == "table" then
for k,v in pairs(_msg) do
if msg and name ~= player.Name then
if string.find(string.lower(msg),string.lower(v)) then
return v
end
end
end
else
print("Incorrect message usage")
end
until msg == nil
end
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 6:30 am
by lisa
Yeah I suspected it was one of my old ones lol
I am older and greyer since then, I suguest using the functions that are part of the default bot now, the ones I described last post.
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 7:13 am
by Jandrana
Thanks for your update.
Yeah I suspected it was one of my old ones lol
I just followed the rule #1 in your forum signature

. The problem I mentioned some time ago, the forum is a big mess... *but I didn't say anything*
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 7:27 am
by lisa
made me lol =)
Yeah the wiki is umm lacking, yeah lacking is a good word.
Basically what we need is a "teacher" as opposed to a "doer", I am a doer and like to make things work but sitting down explaining everything isn't my cup of tea.
Rock mentioned he would look at redoing the Wiki if a programme for wikis comes out for easy editing, "what you see is what you get".
I did some updating to theromwiki a while back and hated the format for editing =(
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 7:38 am
by rock5
I'm actually looking forward to it. There is an official wysiwyg editor being developed called VisualEditor. I'm sure Administrator will install it once he is confident it is ready for our needs. I don't think he ever considered 3rd party editors because he could not be sure of continued support and development, even if he could find one that worked with our content, which I believe he didn't. I believe initial versions have already been released. I think it is scheduled to be stable and "finished" by about mid year. But maybe it will be good enough to install before then. We can only hope.
http://www.mediawiki.org/wiki/VisualEditor
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 8:05 am
by lisa
just so you know I edited the "userfunction" post telling people to use the existing functions that are part of default bot.
My example is probably bad but atleast it is there lol
Also moving this topic to "runes of magoc section, out of the userfunction section.
Once someone has a fully working script or 2 they can just create a topic in the userfunction/wp section for the finished product.
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 2:55 pm
by Eggman1414
Ok so i have done some tinkering with the script and came up with this:
The Script buys 10 Excellent Belts and runs over to the mailbox but errors out at who it is sending the belts to.
Cant seem to add a picture of the error??
Anyways it says:
Fri Jan 25 14:42:16 2013 : ...ts/rom/userfunctions/addon_Rock5s_Mail_Functions.lua:399: You must specify a recipient to use UMM_SendAdvanced()
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
-- Buy Belts script - V1.0 - written by Jandrana
-- Edited by Eggman1414
recipient = SetCharList({
{account=2 , chars= {2,3,4,5,6,7,8}},
{account=54 , chars= {1,2,3,4,5,7,8}},
{account=55 , chars= {1,2,3,4,5,6,7,8}},
});
-- the char that should receiver the belts.
itemName = "Excellent Belt";
function buyBelts()
player:openStore("Nebular Grey-Eye")
store:buyItem(itemName, 10);
yrest(1000)
end
function sendBelts()
local armor=MGbuildItemTableOfType("Armor");
armor=selectItemsByName(armor, itemName);
UMM_SendAdvanced(recipient,getIdsFrom(armor), nil, nil, nil, nil, nil, nil, nil, nil, nil);
end
</onLoad>
<!-- # 1 --><waypoint x="2467" z="48296" y="136">
buyBelts();
</waypoint>
<!-- # 2 --><waypoint x="2603" z="48202" y="136"> </waypoint>
<!-- # 3 --><waypoint x="2812" z="48230" y="136">
sendBelts();
</waypoint>
<!-- # 5 --><waypoint x="2576" z="48212" y="136"> </waypoint>
<!-- # 6 --><waypoint x="2471" z="48302" y="136">
</waypoint>
</waypoints>
Now my question is, does the UMM_SendAdvanced command accept a set char list for the recipient variable? Like below?
Code: Select all
recipient = SetCharList({
{account=2 , chars= {2,3,4,5,6,7,8}},
{account=54 , chars= {1,2,3,4,5,7,8}},
{account=55 , chars= {1,2,3,4,5,6,7,8}},
});
*Edit* I was just thinking, is it becasue SetCharList is already in the onload section? And if so is there a command to call the next character's name, or do I have to make a name table of every alt and do it that way?
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 7:37 pm
by lisa
This part won't work at all
Code: Select all
UMM_SendAdvanced(recipient,getIdsFrom(armor), nil, nil, nil, nil, nil, nil, nil, nil, nil);
It's probably better if rock makes a suguestion as he knows more about the userfunction than me but I will say that recipient needs to be the characters name you are sending the items to, so it needs to be the actual name.
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 9:17 pm
by Eggman1414
I ask because I have seen a number of people use just a name table and insert every alt's name.
Like kenzu38 posted on Rock5's Mailmod Thread
http://www.solarstrike.net/phpBB3/viewt ... &start=380
Code: Select all
<onLoad>
nameTable =
{
"Char1","Char2",etc etc
}
counter = 1
</onLoad>
<!-- # 1 --><waypoint x="31761" z="3614" y="-17">
if nameTable[counter] == "lastchar" then
print("Done mailing.")
player:sleep()
else
UMM_SendMoney(nameTable[counter], 240000)
yrest(500);
sendMacro("CloseAllWindows()");
counter = counter + 1;
end
</waypoint>
</waypoints>
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 11:04 pm
by rock5
The function SetCharList is specifically for use with LoginNextChar().
The name table idea would work but it would need a list of names. You can't use numbers.
Re: Elf Daily And Tier Stones
Posted: Fri Jan 25, 2013 11:45 pm
by Eggman1414
Ok think I got it working. It is running in the background as I write this. Here is the code:
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
-- Buy Belts script - V1.0 - written by Jandrana
-- Edited by Eggman1414
nameTable =
{
--characters name goes here ("Example")
}
counter = 1
itemName = "Excellent Belt";
function buyBelts()
player:openStore("Nebular Grey-Eye")
store:buyItem(itemName, 10);
yrest(1000)
end
function sendBelts()
local armor=MGbuildItemTableOfType("Armor");
armor=selectItemsByName(armor, itemName);
UMM_SendAdvanced(nameTable[counter],getIdsFrom(armor), nil, nil, nil, nil, nil, nil, 10, nil, nil);
yrest(500);
sendMacro("CloseAllWindows()");
counter = counter + 1;
end
</onLoad>
<!-- # 1 --><waypoint x="2467" z="48296" y="136">
buyBelts();
</waypoint>
<!-- # 2 --><waypoint x="2603" z="48202" y="136"> </waypoint>
<!-- # 3 --><waypoint x="2812" z="48230" y="136">
if nameTable[counter] == "Last characters Name Goes Here" then
print("Done mailing.")
player:sleep()
else
sendBelts();
end
</waypoint>
<!-- # 4 --><waypoint x="2576" z="48212" y="136"> </waypoint>
<!-- # 5 --><waypoint x="2471" z="48302" y="136">
</waypoint>
</waypoints>
So im going to do the same script except use Fusion Stones for the next one.