Home   Help Search Login Register  

Author Topic: Damn numbers ..  (Read 4036 times)

0 Members and 2 Guests are viewing this topic.

Hartza

  • Guest
Damn numbers ..
« on: 23 Aug 2002, 23:42:25 »
How do I tell in script
number less than 1 ( my guess <1 )
number is bigger or equal to 1 but lesser than 2 ( my guess ?)
Number is equal or bigger than 2 (my guess >=2)

How to tell that ?
 :-[

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Damn numbers ..
« Reply #1 on: 23 Aug 2002, 23:44:50 »
less than: <#

more than: >#

less or equal: <=#

more or equal: >=#

dunno about inbetween numbers

:thumbsup:
Proud Member of the Volunteer Commando Battalion

Hartza

  • Guest
Re:Damn numbers ..
« Reply #2 on: 23 Aug 2002, 23:45:59 »
damn,

that "between numbers" is bugging me ...

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:Damn numbers ..
« Reply #3 on: 23 Aug 2002, 23:51:32 »
inbetween

>= # && <=#

Bremmer

  • Guest
Re:Damn numbers ..
« Reply #4 on: 23 Aug 2002, 23:51:45 »
Try using:

num <= # && num >= #

Slightly longer than proper scientific notation, but still not too clumsy.

Cheers

[edit] He's quick on the draw that Black_Feather  8) [/edit]
« Last Edit: 23 Aug 2002, 23:54:15 by Bremmer »

Hartza

  • Guest
Re:Damn numbers ..
« Reply #5 on: 23 Aug 2002, 23:52:26 »
okay ...
can somebody tell me how to define random number as whole numbers ?

I gaves numbers like 1.001 or 1.989 ...
how do I conver these like 1 and 2 ...  ???

Marksman

  • Guest
Re:Damn numbers ..
« Reply #6 on: 23 Aug 2002, 23:56:14 »
In between numbers, just use boolean logic

e.g.

ANDs, ORs etc.

So for example:

"A is less than 10 and B is greater than 10"

would be

(A<10 && B>10)

or

(A<10 && 10<B)

where && stands for 'AND'

~~~~

"A is less than 10 or B is less than 10" would be:

(A<10 || B<10)

where || stands for OR
(the key for '|' is the backslash one next to 'z'. Just press shift then the backslah key)

I think you can also just use

(A<10 AND B<10)
(A<10 OR B<10)

Not sure though

Hope this helps,

Marksman

Edit: lol, looks like you got 3 answers for the price of one!!
 ;)
« Last Edit: 24 Aug 2002, 00:01:03 by Marksman »

Hartza

  • Guest
Re:Damn numbers ..
« Reply #7 on: 23 Aug 2002, 23:56:19 »
no luck, :error unknown operator ...

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:Damn numbers ..
« Reply #8 on: 24 Aug 2002, 00:00:07 »
_number = Random 10
? ((_number mod 1) >= 0.5): _number = _number + 1
_number = _number - (_number mod 1)

Hartza

  • Guest
Re:Damn numbers ..
« Reply #9 on: 24 Aug 2002, 00:01:34 »
I have 3 variables ( 1,2,3 ) which are true depending random number.
Problem is that random operator gives number like 1.001 or 1.999.
If random number gives something like 1.999, it is not true because it is not 1 nor 2 ...

So, my script wont work ...

Marksman

  • Guest
Re:Damn numbers ..
« Reply #10 on: 24 Aug 2002, 00:02:41 »
Which command gives you an unknown operator?

the 'AND' and 'OR'

or the '&&' and '||'

???


Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:Damn numbers ..
« Reply #11 on: 24 Aug 2002, 00:06:02 »
_number = Random 2
? ((_number mod 1) >= 0.5): _number = _number + 1
_number = _number - (_number mod 1)

then use

? _number == 0 :dosomething
? _number == 1 :dosomething
? _number == 2 :dosomething

Hartza

  • Guest
Re:Damn numbers ..
« Reply #12 on: 24 Aug 2002, 00:06:46 »
>=1 and <=2   = invalid number of expression

Marksman

  • Guest
Re:Damn numbers ..
« Reply #13 on: 24 Aug 2002, 00:07:36 »
Do something like:

?(RandomNumber >= 1 && RandomNumber < 1.5):MyVariable1 = TRUE

?(RandomNumber >= 1.5 && RandomNumber < 2):MyVariable2 = TRUE


etc..

Where ? stands for 'if'

Marksman
« Last Edit: 24 Aug 2002, 00:08:37 by Marksman »

Hartza

  • Guest
Re:Damn numbers ..
« Reply #14 on: 24 Aug 2002, 11:53:28 »
Ok, this seems to be working version of my script  :thumbsup:

Here is short description what I was doing, If anybody happens to be interested ...

This script designates an route to vehicle called Ural, depending if vehicle named bmp is destoyed or not.
If bmp is destroyed, ural picks randomly one of the three alternative routes. This Normal route is Urals waypoint route and these Alternative routes are made with GameLocig and triggers with ural domove getpos commands.
In english, if bmp in not destroyed, ural will follow it (Normal route), but if bmp is destroyed, ural will pick an other route (Alternative route)...

Activation in game:
Trigger vith East present
OnActivation: [] exec "ural_route.sqs"
__________________________
ural_route.sqs

_number= random 3
#loop
~1
? ((_number mod 1) >= 0.5): _number = _number + 1
_number = _number - (_number mod 1)
TitleText [format["Normal route"],"plain"]
?!(alive bmp):goto "destroyed"
goto "loop"
#destroyed
?(_number >= 0 && _number < 0.9):ural domove getpos move1;TitleText [format["Alternative route 1 )",_number],"plain"]

?(_number >= 1.0 && _number < 1.9):ural domove getpos move2;TitleText [format["Alternative route 2 )",_number],"plain"]
?(_number >= 2.0 && _number < 3):ural domove getpos move5;TitleText [format["Alternative route 3 )",_number],"plain"]
exit

If ýou like see how it works , I can send you an mission by email...

Thanks guys for helping me with this, especially you Black_Feather   :wave:
« Last Edit: 24 Aug 2002, 11:55:41 by Hartza »