Page 1 of 1

Code problem

Posted: Wed Sep 17, 2014 12:50 pm
by Maxalu
Hello i some problems with my code

Code: Select all

<!-- #  2 --><waypoint x="5121" z="2510" y="0">
			if (getCurrency("honor") >= 25000) then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("wracamy")
	fly()
</waypoint>
	<!-- #  3 --><waypoint x="5070" z="2565" y="69">	</waypoint>
what is wrong with it ? it gets a LUA compilation and execut fail/stuck
any 1 can help me out?

Re: Code problem

Posted: Wed Sep 17, 2014 1:08 pm
by rock5
A basic 'if' statement should look like this
  • if condition then
    • -- commands
    end
Notice the 'end' at the end.

Re: Code problem

Posted: Wed Sep 17, 2014 2:11 pm
by Maxalu
rock5 wrote:A basic 'if' statement should look like this
  • if condition then
    • -- commands
    end
Notice the 'end' at the end.
i have tried with the 'end' at the end and without it still fails...

Code: Select all

<onLoad>	
speed()
</onLoad>

	<!-- #  1 --><waypoint x="5121" z="2510" y="0" tag="farma">
			if (getCurrency("honor") >= 25000) then
				__WPL:setWaypointIndex(__WPL:findWaypointTag("wracamy")
			end
	fly()
	</waypoint>
	<!-- #  2 --><waypoint x="5070" z="2565" y="69">	</waypoint>
	<!-- #  3 --><waypoint x="4927" z="2684" y="158">	</waypoint>
	<!-- #  4 --><waypoint x="4705" z="2834" y="267">	</waypoint>
	<!-- #  5 --><waypoint x="4399" z="2971" y="282">	</waypoint>
	<!-- #  6 --><waypoint x="3881" z="3126" y="307">	</waypoint>
	<!-- #  7 --><waypoint x="3559" z="3213" y="313">	</waypoint>
	<!-- #  8 --><waypoint x="3113" z="3443" y="311">	</waypoint>
	<!-- #  9 --><waypoint x="2837" z="3743" y="321">	</waypoint>
	<!-- # 10 --><waypoint x="2656" z="3945" y="318">	</waypoint>
	<!-- # 11 --><waypoint x="2517" z="4102" y="301">	</waypoint>
	<!-- # 12 --><waypoint x="2405" z="4236" y="234">	</waypoint>
	<!-- # 13 --><waypoint x="2318" z="4346" y="171">	</waypoint>
	<!-- # 14 --><waypoint x="2244" z="4435" y="119">	</waypoint>
	<!-- # 15 --><waypoint x="2097" z="4603" y="35">	</waypoint>
	<!-- # 16 --><waypoint x="2067" z="4461" y="118">	</waypoint>
	<!-- # 17 --><waypoint x="2058" z="4333" y="185">	</waypoint>
	<!-- # 18 --><waypoint x="2057" z="4202" y="217">	</waypoint>
	<!-- # 19 --><waypoint x="2060" z="4014" y="233">	</waypoint>
	<!-- # 20 --><waypoint x="2060" z="3794" y="249">	</waypoint>
	<!-- # 21 --><waypoint x="2060" z="3622" y="263">	</waypoint>
	<!-- # 22 --><waypoint x="2060" z="3374" y="281">	</waypoint>
	<!-- # 23 --><waypoint x="2060" z="3176" y="297">	</waypoint>
	repeat
this is the full wpt with code usage... wtf is wrong :cry:

Re: Code problem

Posted: Wed Sep 17, 2014 2:14 pm
by BlubBlab
You missing a closing ) at least.

Code: Select all

    if (getCurrency("honor") >= 25000) then
            __WPL:setWaypointIndex(__WPL:findWaypointTag("wracamy"))
         end
   fly()

Re: Code problem

Posted: Wed Sep 17, 2014 2:20 pm
by Maxalu
BlubBlab wrote:You missing a closing ) at least.

Code: Select all

    if (getCurrency("honor") >= 25000) then
            __WPL:setWaypointIndex(__WPL:findWaypointTag("wracamy"))
         end
   fly()
:lol: im so DUMB :oops: thx must be more focused as a new comoner

Re: Code problem

Posted: Thu Sep 18, 2014 5:15 am
by Maxalu
a question i can buy up to 58 items at once then i want 2 close the store use the items and start buying them again till i have less than 1k of honor is that possible?



Code:
if getCurrency("honor") > 1000 then
store:buyItem(x, 57)
yrest(5000)
RoMScript("CloseAllWindows()")
inventory:useItem(x)
yrest(2000)
until inventory:itemTotalCount(x) == 0
until 250 > getCurrency("honor") then
__WPL:setWaypointIndex(__WPL:findWaypointTag("kup"))
else
__WPL:setWaypointIndex(__WPL:findWaypointTag("lecim"))
end
end
end


i thought of smt like this but its get a compilation error coz i probobly ate somthing...

Re: Code problem

Posted: Thu Sep 18, 2014 6:10 am
by rock5
Try this

Code: Select all

while getCurrency("honor") > 1000 do
   store:buyItem(x, 57)
   yrest(5000)
   RoMScript("CloseAllWindows()")
   repeat
      inventory:useItem(x)
      yrest(2000)
   until inventory:itemTotalCount(x) == 0
end
That will keep buying and using all the items until your honor is less than 1000. I don't understand the bit about 'kup' and 'lecim'. When do you want to go to kup and when do you want to go to lecim?

Re: Code problem

Posted: Thu Sep 18, 2014 6:29 am
by Maxalu
rock5 wrote:Try this

Code: Select all

while getCurrency("honor") > 1000 do
   store:buyItem(x, 57)
   yrest(5000)
   RoMScript("CloseAllWindows()")
   repeat
      inventory:useItem(x)
      yrest(2000)
   until inventory:itemTotalCount(x) == 0
end
That will keep buying and using all the items until your honor is less than 1000. I don't understand the bit about 'kup' and 'lecim'. When do you want to go to kup and when do you want to go to lecim?
i wanted 2 go to "kup" if my honor is above 1k( the tag was on the shop ) and "lecim" if its below 1000
thx for the code i will try it asap