Can you set a variable as a non-numeric value?

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

Snappahead
orc pawn
orc pawn
Posts: 19
Joined: Sun Oct 27, 2002 4:41 am

Can you set a variable as a non-numeric value?

Post by Snappahead » Wed Oct 30, 2002 12:07 pm

What I would like to do is set a variable as a string and not a number. For example

Code: Select all

/varset v10 "Bat Wing"
/varset v11 "Frosting"
/varset v12 "Sauces"
/varset v13 "Fresh Fish"
Then, doing a skill check with

Code: Select all

/varset v80 $char(skill,Baking)
/if n $v80<40 {/varset v30 $v10 /varset v31 $v11}
/if n $v80<56 {/varset v30 $v12 /varset v31 $v13}
Once I have all of the variables defined, I want to be able to use them in a combine macro that will select the correct ingredient depending on my skill.

Code: Select all

/finditem $v30
/if $find()==FALSE /return
/click left pack $v80 0

/finditem $v31
/if $find()==FALSE /return
/click left pack $v80 1
etc...
The idea here being that v30 and v31 will be the correct ingredient at a certain skill level. In the above example, under a skill of 40 will combine a bat wing and frosting, but over that and under 56, it will combine a fish and the sauce (providing they are in my inventory).

I am not too sure of the syntax that should be used to do it. Is that possible? Or am I barking up the wrong tree...? I can't test it for myself at the moment as I am at work for the next 12 hours or so.

Cheers,

Snappahead

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

Post by ap50 » Wed Oct 30, 2002 8:05 pm

I like it..
[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

Snappahead
orc pawn
orc pawn
Posts: 19
Joined: Sun Oct 27, 2002 4:41 am

Post by Snappahead » Thu Oct 31, 2002 2:48 am

I am glad you like it, but can anyone tell me if the syntax is correct? I am having some problems with the macro I have actually written and not too sure if my use of variables is correct or not...

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Thu Oct 31, 2002 5:53 am

Not tested this in game but it look slike you need the add quotes around your string variables like so.

Code: Select all

 

/varset v80 $char(skill,Baking) 
/if n $v80<40 {/varset v30 "$v10" /varset v31 "$v11"} 
/if n $v80<56 {/varset v30 "$v12" /varset v31 "$v13"} 
 

/finditem "$v30" 
/if $find()==FALSE /return 
/click left pack $v80 0 

/finditem "$v31" 
/if $find()==FALSE /return 
/click left pack $v80 1 
etc... 
 
Fippy

However you night want to look at arrays to do this. Ill post an example later if i can.

Snappahead
orc pawn
orc pawn
Posts: 19
Joined: Sun Oct 27, 2002 4:41 am

Post by Snappahead » Thu Oct 31, 2002 6:00 am

Thanks for the tip Fippy - I kinda hit the wall with this one. I haven't been able to test with the quotes as yet.

An example of an array would be interesting to see as well - I am eager to see any ways which this could be accomplished.