# How can i make this thing read a number

Hawlowe Version: 3.3.3

Ok, i am looking for some advice on how to make this ungodly abomination work. i am an very new and an absolute idiot… lol, but i am learning as i go but alot of help is needed with this dumb… thing.

(set:\$Card to 0 + (random:1,10))(print:\$Card)

The Idea was this spits out a random number… called a Card. a second one is randomized as sort of an opponent to fight against.

(set:\$AI to 0 + (random:1,10))(print:\$AI)

now here’s where i am having alot of difficulty.

(set: \$Opponent to \$Opponent +1,(if:\$Card is > \$AI,))

(set: \$You to \$You +1,(if:\$Card is < \$AI,))

and if yours is lower than your opponent. you take +1.stored in a variable or something, called \$You, for the player and \$Opponent for the opponent.

i have no idea on how to make, use or even know what a data-map is or how to use arrays or anything of the sort, so i am trying to make a simple way around the technical stuff by trying to use simple things.

such as strings, ifs and sets… for some simple number checking, like if one number is higher, adding numbers, making a random number do something and so on.

Any advice on how to go about it or any solutions to this dumb problem would help alot.

If you look at the `(set:)` macro’s documentation you will see that’s its usage information makes no mention of passing a conditional argument (like a (if:) macro) to the macro.

And if you look at the `(if:)` macro’s documentation you will see that that macro is meant to be associated with a Hook, that contains the content to process when the `(if:)` macro’s conditional expression evaluates to true.

So if we use the `(if:)` macro’s examples as a starting point your…

``````(set: \$Opponent to \$Opponent +1,(if:\$Card is > \$AI,))
``````

…should look more like…

``````(if: \$Card > \$AI)[
(set: \$Opponent to it + 1)
]
``````

…and your…

``````(set: \$You to \$You +1,(if:\$Card is < \$AI,))
``````

…should look more like…

``````(if: \$Card < \$AI)[
(set: \$You to it + 1)
]
``````

note: Because your `\$Card > \$AI` and `\$Card < \$AI` conditional expressions are what’s known as Mutually Exclusive, as in both conditions can’t be true at the same time, then ideally you would use a `(else-if:)` macro call for the 2nd (or later) related condition…

``````(if: \$Card > \$AI)[
(set: \$Opponent to it + 1)
]
(else-if: \$Card < \$AI)[
(set: \$You to it + 1)
]
``````

…that way if the 1st condition evaluates to being true then the 2nd condition won’t be checks because it can’t be true, thus saving some processing time.

2 Likes

Wow. that helped a ton. i didn’t actually realize i needed to hook it and i thought i could just put it all in the same rounded () brackets. i really appreciate the info too. i better record it so i don’t forget to hook it with square brackets. use an else if to make sure it doesn’t conflict with itself and to try not to set an if again. and use an if first to actually set out whats going on.