any code to detect if a card is owned?
any code to detect if a card is owned?
as title, any snippets that help me detect if a monster card is owned or not?
thanx in advance
thanx in advance
Re: any code to detect if a card is owned?
Hey howdy botje. There is an addon that will paint "learned" or unlearned in green/red on the card. Maybe something from the addon could be modded to meet your needs in a script but I'm not sure. Sorry couldn't help more.
Re: any code to detect if a card is owned?
Ok made a little function. tag: havecard
It accepts names or ids. Note: it only accepts the creature name, not the full card name. So this wont work.
But these will
Of course you will still need to look for cards in your inventory. Let me know if you need help with that too.
Code: Select all
function haveCard(idorname)
if type(idorname) == "string" and type(tonumber(idorname)) ~= "number" then
idorname = "\""..idorname.."\""
end
return RoMScript("} for x=0,15 do "..
"local cc=LuaFunc_GetCardMaxCount(x) "..
"if cc~=nil and cc>0 then "..
"for y=1,cc do "..
"local i,f,n=LuaFunc_GetCardInfo(x,y-1) "..
"if i=="..idorname.." or n=="..idorname.." then "..
"a={f==1} "..
"end "..
"end "..
"end "..
"end z={")
endCode: Select all
haveCard("Card - Abyssal Shadow")Code: Select all
haveCard("Abyssal Shadow")
haveCard(771059)
haveCard("771059")- 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: any code to detect if a card is owned?
nice rock 
i would like to put that in my cleanbag function, but would i use item:id to pass it on to the function you made?
Code: Select all
function CleanBag(sellprize, rarity, drop)
inventory:update();
if sellprize == nil then sellprize = 750 end;
if rarity == nil then rarity = 1 end;
if drop == nil then drop = false end;
for i, item in pairs(inventory.BagSlot) do
if item.SlotNumber >= settings.profile.options.INV_AUTOSELL_FROMSLOT + 60 and
settings.profile.options.INV_AUTOSELL_TOSLOT + 60 >= item.SlotNumber then
if (item:isType("Weapons") or item:isType("Armor")) and sellprize > item.Worth and item.Quality < rarity then
printf("Deleting Item: "..item.Name.."\n");
item:delete()
logInfo("CleanBag", "Deleted: " ..item.Name.. "." , true)
elseif item:isType("Recipes") then
if RoMScript("GetCraftItemInfo("..item.Id..")") == nil then -- Don't have it
printf("Learning recipe: "..item.Name.."\n");
logInfo("LearnRecipe", "Learning recipe: " ..item.Name.. "." , true)
item:use();
yrest(5000);
else
if drop == true then
printf("Deleting Recipe: "..item.Name.."\n");
item:delete()
end
end
elseif item:isType("Monster Cards") then
end
end
end
endRe: any code to detect if a card is owned?
Yes,
Code: Select all
haveCard(item.Id)- 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: any code to detect if a card is owned?
and what exactly does it return? i cant seem to get that from your function, true/false, or 1/2 or???
Re: any code to detect if a card is owned?
Sorry, true or false (or nil I guess if it doesn't make a match). So you would use it like this for example
If you're curious, it gets the true or false from "a={f==1}". When a RoMScript is written like that ie "} some code; a={somevalues} z={" then it returns the values in 'a'. 'f' is the flag of whether you have the card or not. If you do have the card then 'f' should be 1. f==1 is either true or false so the "a={f==1}" will return true or false. I hope that made some sense.
Code: Select all
if haveCard(item.Id) then
item:delete()
else
item:use() yrest(3000)
end- 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: any code to detect if a card is owned?
I am just amazed you got it all into a single macro =)
Remember no matter you do in life to always have a little fun while you are at it 
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: any code to detect if a card is owned?
It was easy, still plenty of room. I still remember what I went through creating the code that gets all the item types from the game. The initial code took about 15 seconds I think or maybe longer, I don't remember exactly. Doing a RoMScript for each type probably meant it was doing well over 120 RoMScripts. Now I think it does it in about 15. Takes about 2.5s
.
- 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: any code to detect if a card is owned?
now all i need is a way to use the recipe color to keep everything from that color upwards and my cleanbag is done 
thanx rock ^^
thanx rock ^^
Re: any code to detect if a card is owned?
That should be easy. 'item' has a Quality value after all.
- 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: any code to detect if a card is owned?
i could not find that on the recipe one O.o
Re: any code to detect if a card is owned?
All inventory items have Quality even recipes.
Code: Select all
Command> print(inventory.BagSlot[61].Name)
Recipe - Tador's Brilliant Armor
Command> print(inventory.BagSlot[61].Quality)
3- 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: any code to detect if a card is owned?
cool, then its indeed easy, thanx ^^
Who is online
Users browsing this forum: No registered users and 1 guest