Page 1 of 1

error with some variable

Posted: Sat Dec 11, 2010 4:15 am
by Personalausweis
hi,

i have a problem with my function:
http://img249.imageshack.us/i/errorlbf.jpg/

function

Code: Select all

function send_to_character(character)
receiver = {LIST OF 64 characters  "twinka", "twinkb", etc}
	-- Open correct tab
	RoMScript("UMMFrameTab1:Hide()") yrest(50)
	RoMScript("UMMFrameTab2:Hide()") yrest(50)
	RoMScript("UMMFrameTab3:Show();") yrest(50)
	yrest(1000);
	for count = 1, 30, 1 do -- for each inventory
		local slotitem = inventory.BagSlot[count];
		local slotNumber = slotitem.SlotNumber
		-- Check all search terms
		if  (_quality == nil or slotitem.Quality <= _quality) and
			(_reqlevel == nil or slotitem.RequiredLvl <= _reqlevel) then
			-- mark to send
			bagid = math.floor((slotNumber-1)/30+1)
			slotid = slotNumber - (bagid * 30 - 30)
			RoMScript("UMMMassSendItemsSlotTemplate_OnClick(_G['UMMFrameTab3BagsBag"..bagid.."Slot"..slotid.."'])")
			yrest(250)
		end
	end
	yrest(1000)
	RoMScript("UMMFrameTab3RecipientRecipient:SetText('"..receiver[character].."');")
	RoMScript("UMMFrameTab3Action:Send()")
	-- Waiting until finished
	repeat
		yrest(2000)
	until RoMScript("UMMFrameTab3Status:IsVisible()") == false
end
waypoint

Code: Select all

MailTo = 1;
repeat 
	<!-- Buy Belts WORKS GOOD-->
   player:target_NPC(116627);
   yrest(500)
   sendMacro("ChoiceOption(1);");
   yrest(500);
   for i = 1, 27, 1
   do
   sendMacro("StoreBuyItem(6)");
   yrest(2000);
   end;
   sendMacro("CloseWindows();");
   yrest(1500);
	<!-- Send belts-->
   for i = 1, 27, 1
   do
   sendMacro("OpenMail();");
   send_to_character(MailTo);
   yrest(1000);
   sendMacro("CloseMail();");
   yrest(500);
   end;
   MailTo == MailTo + 1;
until MailTo = 65


Re: error with some variable

Posted: Sat Dec 11, 2010 4:26 am
by rock5
The error indicates the function wasn't loaded. Where did you put it?

Re: error with some variable

Posted: Sat Dec 11, 2010 6:48 am
by Personalausweis
yeah great i had i still in my todo-folder -.-

thanks


do you know the command to sort my bag?

Re: error with some variable

Posted: Sat Dec 11, 2010 6:50 am
by rock5
Personalausweis wrote:do you know the command to sort my bag?
No. I never use sort.

Re: error with some variable

Posted: Sat Dec 11, 2010 7:00 am
by Personalausweis
hmm when my character gets all stuff from mailbox and then gets the order to start making t7 stones, he always tries to use giftbag, phirius-tokens and so on to merge with fusion stones.
but when i first sort the bag, he did it right...

Re: error with some variable

Posted: Sat Dec 11, 2010 8:14 am
by jduartedj
Personalausweis wrote:hmm when my character gets all stuff from mailbox and then gets the order to start making t7 stones, he always tries to use giftbag, phirius-tokens and so on to merge with fusion stones.
but when i first sort the bag, he did it right...
you can try looking for it in: http://theromwiki.com/index.php/List_of_Functions but i have no idea what to use.

Re: error with some variable

Posted: Sat Dec 11, 2010 8:19 am
by Personalausweis
i already serched this but did not find anything :(

Re: error with some variable

Posted: Sat Dec 11, 2010 8:19 am
by rock5
jduartedj wrote:you can try looking for it in: http://theromwiki.com/index.php/List_of_Functions but i have no idea what to use.
Hm... Maybe RefreshBag?

Re: error with some variable

Posted: Sat Dec 11, 2010 8:59 am
by jduartedj
rock5 wrote:
jduartedj wrote:you can try looking for it in: http://theromwiki.com/index.php/List_of_Functions but i have no idea what to use.
Hm... Maybe RefreshBag?

SPOT ON!

Re: error with some variable

Posted: Sat Dec 11, 2010 10:57 am
by Personalausweis
-.-

refresh, i searched for sort and sth like this xD


thanks guys :)

Re: error with some variable

Posted: Sat Dec 11, 2010 12:25 pm
by Personalausweis
i have a new problem with these functions ... (whitch are now in the correct folders ;) )

a.m. function send_to_character(character)

is not working in this waypoint:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<onLoad>
		Mailto = 1;
	</onLoad>
	<!-- #  2 --><waypoint x="-23406" z="4683">	</waypoint>
	<!-- #  3 --><waypoint x="-23754" z="4501">	
	<!-- send Fusis -->
		player:target_Object("Postfach",100);
		yrest(500);
		for i = 1, 27, 1
		do
		send_to_character(MailTo);
		end;
		if Mailto == 64 then logout() else mailto = MailTo+1 end;
	</waypoint>
</waypoints>

error:
micromacro/scripts/rom/userfunctions/addon_eigene.lua29: attemot to concatenate field'?' (a nil value)

Re: error with some variable

Posted: Sat Dec 11, 2010 6:57 pm
by rock5
Personalausweis wrote: error:
micromacro/scripts/rom/userfunctions/addon_eigene.lua29: attemot to concatenate field'?' (a nil value)
That's a problem, as it says, with 'addon_eigene.lua', line 29. We'll need to see that, to help you fix it.

If that is supposed to be the file with your character function then you didn't post the whole file because the function you posted above only has 26 lines.

Re: error with some variable

Posted: Sat Dec 11, 2010 7:45 pm
by Administrator
I think your problem is that you used the wrong variable multiple times. Capitalization is important. There is a difference between 'mailto', 'MailTo', and 'Mailto'.

Re: error with some variable

Posted: Sun Dec 12, 2010 3:07 am
by Personalausweis
ah ok didn't know that this indicates the line of the error.
line29:

Code: Select all

RoMScript("UMMFrameTab3RecipientRecipient:SetText('"..receiver[character].."');")
changed the variables to "MailTo" so they are now ale the same.

Re: error with some variable

Posted: Sun Dec 12, 2010 11:19 am
by Administrator
I just really don't understand what you're trying to do with that code. You have an array ('receiver') of "characters" (and your use of that "word" irritates me), not a dictionary. That means that receiver[index] will be nil (as it has no assigned value).

Shouldn't you be using this:

Code: Select all

RoMScript("UMMFrameTab3RecipientRecipient:SetText('"..character.."');")
instead?

Re: error with some variable

Posted: Sun Dec 12, 2010 11:37 am
by Personalausweis
i try to send a couple of items to a bunch of characters.

i thought i have to adress the array like this

receiver = {"Toona", "Toonb",...}

so that
receiver[1] = Toona
receiver[2] = Toonb
...

i planned a loop like this:

MailTo = 1
repeat
buy_items
send_to_character(MailTo)
MailTo = MailTo + 1
until MailTo = 64

I want to give the function send_to_character just a number (of the character) and the function converts the number into a string (name of character given from the array)

or is it better to make it like this:

function send_to_character(character)
Char = {"toona", "toonb",...}
receiver = Char[character]
and then
RoMScript("UMMFrameTab3RecipientRecipient:SetText('"..receiver.."');")

i haven't worked with something like this before, but i'm learning ;)

character is german word for character, sry i am used to the word character, i try to write character instead :)

Re: error with some variable

Posted: Sun Dec 12, 2010 11:51 am
by Administrator
Ah, I see. That clears things up a bit. I thought "character" would be the name of a character, not the index.

Maybe the problem is here:

Code: Select all

until MailTo = 65
That should probably be '==', which would give a nil error on the next iteration.


That whole section of code is pretty messy. I've rewritten it for you.

Code: Select all

<![CDATA[
MailTo = 1;
while( MailTo < 65 ) do
	-- Buy belts
	player:target_NPC(116627);
	yrest(500);
	sendMacro("ChoiceOption(1)"); -- Do not include semi-colon!
	yrest(500);

	for i = 1,27 do
		sendMacro("StoreBuyItem(6)");
		yrest(2000);
	end

	sendMacro("CloseWindows()"); -- Do not include semi-colon!

	-- Send belts
	for i = 1,27 do
		sendMacro("OpenMail()"); -- Semi-colon again...
		cprintf(cli.yellow, "[DEBUG] MailTo: %s\n", tostring(MailTo));
		send_to_character(MailTo);
		yrest(1000);
		sendMacro("CloseMail()"); -- More semi-colons...
		yrest(500);
	end

	MailTo = MailTo + 1;
end
]]>
character is german word for character, sry i am used to the word character, i try to write character instead
'character' is just as bad. It's just one of my pet peeves. Back in the good ol' days of gaming, we used to just call them "characters"! Don't mind me.

Re: error with some variable

Posted: Sun Dec 12, 2010 5:34 pm
by jduartedj
Administrator wrote: we used to just call them "characters"! Don't mind me.
I usually say char and character I didn't even knew what characters were! I though you were talking about looney characters! xD Either I call it char or in this case I also call it bot, for obvious reasons!

Re: error with some variable

Posted: Mon Dec 13, 2010 2:34 am
by Personalausweis
thanks a lot admin.

yeah these old days ;)

i read i a couple of english forums characters or alts as a word for chars (characters) so i thought this is a common name for it.
anyway...

thanks a lot, i will test this code this evening and revert as soon as possible.

if this works i will be able to produce T-stones completely automated :)