Error in setting variable?

Need help running MacroQuest2? Ask your questions about how to get things to work on your computer.

Moderator: MacroQuest Developers

oompaloompa
orc pawn
orc pawn
Posts: 10
Joined: Fri Jul 15, 2005 10:23 pm

Error in setting variable?

Post by oompaloompa » Tue Jul 26, 2005 6:46 am

hello
I posted in the wiki at the bottom of this page
http://www.macroquest2.com/wiki/index.php/MQ2DataVars
I have been at trying to solve it for 3 hours now lol
but im trying to make something that will run me to the zone using a specific path cause my mom always wants me to do something and i dont like just standing in the middle of the zone some times
here is what i have so far

Code: Select all

Sub Main
/declare RT int outer
:FirstDestination
/Face loc -1680,-3400
/look 50
/delay 3
/vardata RT Math.Calc[((${My.X}--1680)^2+(${My.Y}--3400)^2)^(1/2)/(4.5)]
/delay 5
/keypress forward hold
/delay RT
/keypress back
/endmacro

okay when i tried to set a variable for the locs it used 0 0 and i did Varset, so something is wrong with my var set is what i am guessing

for the var data im guessing its doing the same thing, ignoring the value i put and keeping it at 0
can some one please help?
for the formula its distance/speed cause our toons go about 31everquestmilesperhour at run 5 which i have. so about 4.5 feet per centisecond.
and also if there is an easier way of doing this please tell me lol thanks for the help guys
Eq tards = retards
how many times do i have to tell you this, tard?

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Tue Jul 26, 2005 7:33 am

Use move.inc or advpath.inc ..

Or, if you want to use the stuff you already wrote change the vardata command to:

Code: Select all

/varset RT ${Math.Calc[((${My.X}--1680)^2+(${My.Y}--3400)^2)^(1/2)/(4.5)]}

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Tue Jul 26, 2005 10:57 am

Only thing that it looks like to me is the double '--', try using just one minus sign in your formula, or instead of /vardata'ing the formula (which will fail silently) just /echo the statement and see what output you get. so

Code: Select all

/vardata RT Math.Calc[((${My.X}-1680)^2+(${My.Y}-3400)^2)^(1/2)/(4.5)]
edit: bah, ignore me, as usual Lax outthinks the normal people at this time of morning.
Last edited by dman on Tue Jul 26, 2005 11:51 am, edited 1 time in total.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Tue Jul 26, 2005 11:49 am

Why are you using vardata or discussing varset when clearly, varcalc is intended for exactly this purpose...
and subtracting a negative works fine.

but... your edit did not belong on the MQ2DataVars syntax page so I removed it (thanks for trying).

Now.. are you aware that ^ is XOR, not a power? You need to use two to make it power.

Code: Select all

/varcalc RT ((${My.X}--1680)^^2+(${My.Y}--3400)^^2)^^(1/2)/(4.5)
Also, you can make that 1/2 ".5" and then add parentheses to make it clear to humans whether you want to divide the .5 by 4.5, or power by .5 and then divide the entire thing by 4.5
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

oompaloompa
orc pawn
orc pawn
Posts: 10
Joined: Fri Jul 15, 2005 10:23 pm

Post by oompaloompa » Tue Jul 26, 2005 4:12 pm

blueninja dman and lax, thank you for your input. sorry about not knowing ^^ was a power, lol im only 16 and ive only programmed in Basic some C script some c++ lots of HTML some javascript PHP... and some other crap lol, thank you so much for pointing this out to me... i want to be a coding genius like you when i grow up =P.

Thank you for the answers guys, i owe you guys =)

gona try lax's code and see if it works (it will unless i make another stupid mistake =))
:D
laterz
Eq tards = retards
how many times do i have to tell you this, tard?

oompaloompa
orc pawn
orc pawn
Posts: 10
Joined: Fri Jul 15, 2005 10:23 pm

Post by oompaloompa » Tue Jul 26, 2005 4:36 pm

Okay well... My ram seems like it doesnt want to store variables or something, this is the code

Code: Select all

Sub Main
/declare RT int outer
/declare Destonex float outer 
/declare Destoney float outer 
:FirstDestination
/varset Destonex -3400
/varset Destoney -1680
/Face loc Destonex,Destoney
/delay 3
/varcalc RT ((${My.X}--1680)^^2+(${My.Y}--3400)^^2)^^(1/2)/(4.5)
/delay 5
/keypress forward hold
/delay RT
/keypress back
/endmacro
and i changed the face loc to variables so i could see if it was storing variables, and just as i had suspected it faced me towards 0,0. is there a rule i'm missing here? cause this should work lol
Edit: is there an easier way to tell it to run to a location on the map?
Eq tards = retards
how many times do i have to tell you this, tard?

drzoon
a hill giant
a hill giant
Posts: 239
Joined: Tue May 04, 2004 5:38 pm

Post by drzoon » Tue Jul 26, 2005 5:52 pm

How about this:

Code: Select all

Sub RunToLoc (int XLoc, int YLoc)
	:run_to
	/if (${Math.Distance[${YLoc},${XLoc}]}<10) {
		/echo At location, returning!
	} else {
		/if (${Math.Distance[${YLoc},${XLoc}]}<20) {
			/keypress forward
			/delay 2s !${Me.Moving}
		} else {
			/face nolook loc ${YLoc},${XLoc}
			/keypress forward hold
			/goto :run_to
		}
	}
/return
PS: I believe I stole most of this from Rusty's Autoenc mac, certainly the idea.

oompaloompa
orc pawn
orc pawn
Posts: 10
Joined: Fri Jul 15, 2005 10:23 pm

Post by oompaloompa » Tue Jul 26, 2005 6:59 pm

Thank you, it works like a charm bud! My way was entirely too complicated lol ;-) im too inexperienced i guess =)
laterz
Eq tards = retards
how many times do i have to tell you this, tard?