Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-28-2006, 12:31 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
ABC Theory

I just made a simple workout for the ABC theory, example:

You have the formule: 2x + 3 = 0
You can work this out like.. -3 on both sides, so 2x = - 3
You do it all / 2, and you'll have x = - 1.5... but now
You've got this formule: -33.5x² + 1.5x + 4 = 0, how are we going to do this?
Fill in for;
a: -33.5
b: 1.5
c: 4

PHP Code:
function onCreated() {
  
= - 33.5;
  
1.5;
  
4;
  
/* Don't edit below here */
  
xr "";
  
= ( 2) - c;
  if ( 
NULL) {
    for ( try: { 
"-""+"}) {
      if ( try = 
"-")
        
xr = ( - - ( 0.5)) / ( a);
      else if ( try = 
"+")
        
xr @= " or " @ ( - + ( 0.5)) / ( a);
    }
  }
  else if ( 
NULL) {
    
xr = - / ( a);
  }
  else
    
xr "No solutions!";
  echo( 
"Result: " xr);

And as you see, the result will be (for 'x' in the formule);
Result: 0.368659933 or -0.323883813

You don't realy have anything that you can use it for in Graal, but whatever, wanted to work it out in a script
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #2  
Old 11-28-2006, 02:37 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Ahhh mathematics!! Algebra!!

*melts*
Reply With Quote
  #3  
Old 11-28-2006, 03:52 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Yes, quadratic formula...I made a program for that on my calculator a few months ago. Cause we were doing it in my Algebra 2 class at the time. I still have it in there, but because I have no clue how to use if statements in its crazy scripting language, it won't work when (b^2-4(a)(c)) is a negative number.

Anyways, a simple, but I suppose useful script.

It is possible to use it with non-real numbers though, if you just do it in terms of i.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #4  
Old 11-28-2006, 07:30 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Thanks ;p I thought, lets go for some rep++; by posting some scripts (I guess I'll do more later)
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #5  
Old 11-28-2006, 08:10 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by contiga View Post
Thanks ;p I thought, lets go for some rep++; by posting some scripts (I guess I'll do more later)
If I figured out how I would give you --rep; for retarded style, and possibly for posting stupidly trivial graal-unrelated code snippets.
Reply With Quote
  #6  
Old 11-28-2006, 08:42 PM
WanDaMan WanDaMan is offline
Master Tux
WanDaMan's Avatar
Join Date: Aug 2002
Location: England, United Kingdom
Posts: 5,571
WanDaMan is a jewel in the roughWanDaMan is a jewel in the rough
Send a message via MSN to WanDaMan
Quote:
Originally Posted by Loriel View Post
If I figured out how I would give you --rep; for retarded style, and possibly for posting stupidly trivial graal-unrelated code snippets.
Un-true; GScript, y0?
__________________
V$:CONFL16T
Reply With Quote
  #7  
Old 11-28-2006, 08:54 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by WanDaMan View Post
Un-true; GScript, y0?
So if I post a bunch of spam that is valid gscript syntax it is Graal-related?
Reply With Quote
  #8  
Old 11-28-2006, 09:01 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
@ Loriel:
You know what.. go beg some Administrator for a "Un-Graal-Related Code Gallery", so I can post this "noncense" (in your eyes) in there.. everyone has his own style btw, don't complain. And it can be useful for people who don't get the ABC theory with maths, they perhaps can learn from it xP
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #9  
Old 11-28-2006, 09:11 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by Loriel View Post
So if I post a bunch of spam that is valid gscript syntax it is Graal-related?
It's gscript related
Reply With Quote
  #10  
Old 11-28-2006, 09:47 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by excaliber7388 View Post
It's gscript related
It's not really relevant to graal though, that's what he is saying.
__________________
Reply With Quote
  #11  
Old 11-28-2006, 09:56 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
What? Why not just call it the quadratic formula x-x

Last edited by Gambet; 11-28-2006 at 10:08 PM..
Reply With Quote
  #12  
Old 11-29-2006, 09:32 AM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
It's simple but effective, you can do your homework faster with it Haha
Like that you have more time for Graal How comes you don't see that connection? xP

PS. I just saw this:

Reputation
Your reputation on this post is Somewhat Negative.
Comments on this Post
I disapprove of posting generic math-related snippets just because they are implemented in gscript and also your style kind of sucks

Sad, haha. Because my style sucks is not a valid reason, I want my 3 points back
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #13  
Old 11-29-2006, 08:51 PM
Galdor Galdor is offline
░▒▓██▓▒░
Galdor's Avatar
Join Date: Feb 2004
Posts: 2,434
Galdor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond repute
Hello I'm galdor and I come from earth, nice to meet you all.
(point is that your aliens that somehow see some sence in that square of nonsense)
__________________
Links
Draenin's Villains
Draenin's Quests

My Albums
Quote:
Originally Posted by Unixmad
This forums is going worst each day.
Reply With Quote
  #14  
Old 11-30-2006, 03:40 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Galdor View Post
Hello I'm galdor and I come from earth, nice to meet you all.
(point is that your aliens that somehow see some sence in that square of nonsense)
It's fairly basic algebra...fairly...



And Contiga, use the wikipedia article, maybe it'll help you make it do it in terms of i when the discriminant is negative.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #15  
Old 11-30-2006, 04:03 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Yeah, um, I learned this back in the 9th grade. You're trying to make it sound a lot more complicated than it really is so that people could be all over you and compliment you, when really you've done nothing spectacular. It's simple math.

It's the quadratic formula, don't try to make it sound like it's anything else.
Reply With Quote
  #16  
Old 11-30-2006, 04:19 AM
SayianOozaru SayianOozaru is offline
Banned
SayianOozaru's Avatar
Join Date: Apr 2005
Location: Waldorf, Maryland
Posts: 3,303
SayianOozaru is on a distinguished road
Send a message via AIM to SayianOozaru
lol.

im in 11th grade, and still haven't even seen that ****. lol.
Reply With Quote
  #17  
Old 11-30-2006, 05:19 AM
Galdor Galdor is offline
░▒▓██▓▒░
Galdor's Avatar
Join Date: Feb 2004
Posts: 2,434
Galdor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond reputeGaldor has a reputation beyond repute
Quote:
Originally Posted by SayianOozaru View Post
lol.

im in 11th grade, and still haven't even seen that ****. lol.
maybe you didndt look hard enough?
__________________
Links
Draenin's Villains
Draenin's Quests

My Albums
Quote:
Originally Posted by Unixmad
This forums is going worst each day.
Reply With Quote
  #18  
Old 11-30-2006, 05:27 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Gambet View Post
Yeah, um, I learned this back in the 9th grade. You're trying to make it sound a lot more complicated than it really is so that people could be all over you and compliment you, when really you've done nothing spectacular. It's simple math.

It's the quadratic formula, don't try to make it sound like it's anything else.
Me? O.o

If so, not really, I'm just suggesting something to Contiga...no need to see to far into things...
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #19  
Old 11-30-2006, 11:47 AM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Quote:
Originally Posted by coreys View Post
And Contiga, use the wikipedia article, maybe it'll help you make it do it in terms of i when the discriminant is negative.
What do you mean with in terms of 'i'?
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #20  
Old 11-30-2006, 04:07 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by contiga View Post
What do you mean with in terms of 'i'?
Oh...I guess you haven't learned it yet.

Well...as I'm sure you know, you can't do a square root of a negative number and get a real number. But you can still represent it with i.

For example:
(-12)^.5

would be
i(12)^.5

Basically i is equal to (-1)^.5
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #21  
Old 12-01-2006, 02:19 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by coreys View Post
Me? O.o

If so, not really, I'm just suggesting something to Contiga...no need to see to far into things...

No, not you, Contiga.
Reply With Quote
  #22  
Old 12-01-2006, 02:46 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Quote:
Originally Posted by coreys View Post
Oh...I guess you haven't learned it yet.

Well...as I'm sure you know, you can't do a square root of a negative number and get a real number. But you can still represent it with i.

For example:
(-12)^.5

would be
i(12)^.5

Basically i is equal to (-1)^.5
Does GS2 read i as -1 tho?
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #23  
Old 12-01-2006, 04:01 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by contiga View Post
Does GS2 read i as -1 tho?
Well its not -1, its the square root of negative one. Thats why I did (-1)^.5. You would obviously have to make a variable. Or possibly just somehow work it into the output of the answer.

I'm not sure if it's possible to get it to work like that, but maybe. (Hey, if my TI-84 can do it, maybe it can be done in gs2 ;[)
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:02 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.