Those math statements

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Those math statements

Post by Alcoholic »

I forgot what they were called, but I learned them in elementary school. Whats the name of those statements that come out like this?

100,000 + 20,000 + 5 = 120,005

Is there a way to do that in mohaa? Like if I had an 8 and a 4, could I add it so it makes 84?
User avatar
HappyChappy_7000
Warrant Officer
Posts: 146
Joined: Thu Jul 10, 2003 1:14 pm
Location: Australia
Contact:

Post by HappyChappy_7000 »

80+4.you can't make it 8 + 4 to 84 coz it doesn't make sense.(to me it doesn't) :(
What? You know who I am?
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

gotta do it the hard way then... :cry:
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Post by tltrude »

(10 * 8) + 4 = 84
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Or: int("8" + "4") = 84 :wink:
Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

cool that works?
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

to all concerned....

Post by grb »

just in case someone is wondering what the heck the "int" function does...
It interprets whatever is enclosed in double quotations as alpha numerical
strings and then converts the characters representing integer numbers into
a integer form.
So......using jv_maps example......
int("8" + "4") = 84
the int function evaluates the alphanumeric character "8" as a integer numeric 8 and the alphanumeric character "4" as being an integer 4 THEN
concatonates (joins them together in a string) then CONVERTS THE STRING INTO IT'S integer form.
As to Alcoholic's question....what is the name of the term for a sequence such as 100,000 + 20,000 + 5 = 120,005
I believe you would call it a Polynomial term. That is it contains more then two (binomial) sets of numbers on one side of the equal sign.

ex:
A +B = C would be a binomial as apposed to A (B*C) = D being more then two elements which would be of a polynomial form. And for those that have been away from math for some time. The above simple examples can be called an equation, because you are equating something on the left hand side of the equal sign to being equal to something on the righthand side of the equal sign.

cheers
grb
TheShiznaeSpe
Major
Posts: 304
Joined: Wed Feb 05, 2003 11:45 pm
Location: US
Contact:

Re: to all concerned....

Post by TheShiznaeSpe »

grb wrote:just in case someone is wondering what the heck the "int" function does...
It interprets whatever is enclosed in double quotations as alpha numerical
strings and then converts the characters representing integer numbers into
a integer form.
So......using jv_maps example......
int("8" + "4") = 84
the int function evaluates the alphanumeric character "8" as a integer numeric 8 and the alphanumeric character "4" as being an integer 4 THEN
concatonates (joins them together in a string) then CONVERTS THE STRING INTO IT'S integer form.
As to Alcoholic's question....what is the name of the term for a sequence such as 100,000 + 20,000 + 5 = 120,005
I believe you would call it a Polynomial term. That is it contains more then two (binomial) sets of numbers on one side of the equal sign.

ex:
A +B = C would be a binomial as apposed to A (B*C) = D being more then two elements which would be of a polynomial form. And for those that have been away from math for some time. The above simple examples can be called an equation, because you are equating something on the left hand side of the equal sign to being equal to something on the righthand side of the equal sign.

cheers
and that's why i almost failed both algebra and geometry :?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

It's all comprehensible as long as you stick to the point (unlike grb :P), but nice info anyway :wink:
Image
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

Sorry for the verbosity....just trying to help.

Post by grb »

I was only trying to explain to HappyChappy_7000, how the int() function works, since he indicated that he did not understand your reply. And also
provide a simple answer to Alcoholic to his question. Sorry if it appeared to be to lenghtly an answer. No respones required. And no ill feelings harbored in any way.

cheers
grb
TheShiznaeSpe
Major
Posts: 304
Joined: Wed Feb 05, 2003 11:45 pm
Location: US
Contact:

Post by TheShiznaeSpe »

i'm just messing with, man :D
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

well while where at it....

Post by grb »

Can Jv_Map or some other expert give a good example of where we would want to use the int() function in the manner it was used in the example in this thread? Not sure what use it would have in the context of the example, but then again, most of the time I'm not to bright.

I think I will check out some of the stock scr files to see where the int()
function may be used.

And TheShiznaeSpe..... I understood your comment to imply no negative.
I failed algebra many years ago before I started to get serious about obtaining some form of education.

cheers all
grb
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I know where Alcoholic needs it for but I won't yet tell. It may be a 'top secret' project ;)
Image
grb
Warrant Officer
Posts: 136
Joined: Fri Jun 06, 2003 12:22 am
Location: USA Philadelphia

jv_map...

Post by grb »

fair enough. Incidentally after a search thru ALL the PK0 global files for a string that contained "int(" to catch any int function call, I found not one.
So it appears that the folks who created the stock missions did not have a
need to use the function.

cheers
grb
sysQuik
Corporal
Posts: 25
Joined: Fri Feb 07, 2003 9:54 am

Post by sysQuik »

How about if you want to make a variable an integer like "20" instead of "20.000". So...

Code: Select all

main:
  level.mynumber = 100
  thread my_value
end

my_value:
  local.n = (level.mynumber) * .1
  println "local.n = " (local.n) 
end

This will output something like "local.n = 10.000". How would you make it output "local.n = 10", basically getting rid of the decimal places? I've tried int (local.n), (int local.n) and variations of these, but they don't work. I read through all the docs I can find as well as through this index, but I haven't seen int used with variables. Any ideas?

Take it easy,
SysQuik
Post Reply