Discuss and collaborate on GML scripts

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

Yes, Imma change the room size : I'm using 800x592.

And of course, the noob that I am is gonna ask you : where to put those two lines {drawx = width * (xx - x0) / (x1 - x0); drawy = height * (y0 - yy) / (y1 -y0)} ?

And also, when you mean width and heigth in your formulas, do you mean room_width and room_height ?

Again, thank you, xot !

I'm now experimenting some troubles with it... I mean, I'm using it in my final project, but I have a problem with entering the window...

But anyway, my real problem is here : I don't really understand this part of the code :

```
1. var i, xx, yy;
2. for (xx=-3.2; xx<=3.2; xx+=0.001)
3. {
4. yy = 0;
5. for (i=0; i<=n; i+=1)
6. {
7. yy = yy + p[i] * power(xx, i);
8. }
9. draw_point(100*xx+320, 100*yy+240);
10. }
```

I know it's for drawing the points, but the lines 2 and 9 are quite strange for me... Why having xx=-3.2 ? And I don't understand the full command draw_point(100*xx+320, 100*yy+240);...

NervaL928 wrote:Also, now that I have this, I think it's possible to get functions like [tex]\frac{1}{x}[/tex] or [tex]e^x[/tex] or [tex]\sqrt{x}[/tex] or [tex]ln(x)[/tex], right ?

As for the other functions, that's no longer a polynomial, so it's not really clear what you asking for. You could replace the second block of code with:

`yy = sqrt(xx);`

... or whatever function of xx you want.

Thanks ! This will do !

About the "glitchy signs", I meant you get this : [tex]ax^n+bx^{n-1}+cx^{n-2}+...+Nx^{n-n} \to -ax^n+bx^{n-1}+cx^{n-2}+...+Nx^{n-n}[/tex]

Edit : the "320+100*xx, 240-100*yy" replacement worked and fixed the problem, so thatnk you again, xot !

This is... AWESOME !

It works perfectly fine, thanks xot I'll credit you for this in my work !

Also, now that I have this, I think it's possible to get functions like [tex]\frac{1}{x}[/tex] or [tex]e^x[/tex] or [tex]\sqrt{x}[/tex] or [tex]ln(x)[/tex], right ?

And then, just a little thing more... Is it possible to have the curve without the points ? Or I mean, all the points ? Like, you don't have space between them ? If not, no matter, that's cool

Thanks again for your time, I looove this

Edit : for linking all the points, I changed "xx+=0,01" into "xx+=0,001" and it works fine :-)

Edit2 : the first monomial sign is glitchy... In fact, we get its opposed...

Okay, so now I have the file !

Get in from my DropBox now : https://www.dropbox.com/s/v1igub18ccem7 … _color.gmk

Edit : now it recolors the full sprite into transparent one

Okay, I'm at school now, so Imma upload it for you this evening ;P

**NervaL928**- Replies: 9

Hello everybody :)

I got a problem with something, that I thought solution was on this page : http://www.gmlscripts.com/script/drawing_shapes

I didn't find anything interesting for me...

Since you have LaTeX installed, let me use it :)

What I want to do is basically calling number of monomials a functions has, and then you call for all the monomial values... Like in this :

[tex]f(x) \to ax²+bx+c[/tex]

You have three monomials (this is a polynomial of degree two in fact).

Note : usually, we don't use complicated functions, like [tex]x \to x^{18}[/tex], but others like [tex]e^x[/tex] or [tex]\frac{1}{x}[/tex] are very useful...

So here, I call for every constant values (I have a problem : how can I ask every constant values until there are no more constants ?) :

```
a = get_integer("Enter a :","")
b = get_integer("Enter b :","")
c = get_integer("Enter c :",""
```

Now that I caught all the monomials values, how can I make the *Game* drawing C, the curve for the function the user entered ?

What I thought was using the room grid, but if it's not a first degree function (C is a line), it might be hard, right ?

Thanks for your replies, but if it's not possible don't matter, I'll try by myself, but note that I'm not posting this without having tried...

xot wrote:

Welcome to the forums, NervaL928. I look forward to seeing any submissions from you. I saw your comment on the sprite_replace_color script and have replied.

I don't know if we have any other French or French-speaking members. The forums don't see a lot of activity, to be honest.

Thanks

This forum should be more frequented !

xot wrote:

Do you make cool stuff with redstone?

I'm trying as I can

I make adventure maps (for now, none are released, but soon )

icuurd12b42 wrote:

Salut Nerval. I'm French too but not from France.

Salut Ravi de savoir que je ne suis plus seul !

**NervaL928**- Replies: 4

Okay guys :), today I found a problem with a script that I needed, so here's this script :

http://www.gmlscripts.com/script/sprite_replace_color

I posted a comment showing that I had an error, so to recap I get this happening :

http://img5.imageshack.us/img5/3862/5lil.png

I get as an answer to check if the sprite was Fully Black, which I did before posting my first comment in fact ;)

But this was a good idea in fact, so I re-checked it, and RGB color for the sprite is #000000 for all the sprite.

I was told to add more info, but I don't know what I can tell you more, if it's not the code in the object (script is exactly the same) :

In step event for the player (object called *objectCharacter*) :

sprite_replace_color(spriteCharacter,c_black,c_aqua)

Hello everyone !

I'm joining you today cuz' I often need scripts, but I would like submitting some also

I'm running Version 8 of GM for the info !

I also have the Standart version of GM:Studio, but I don't use it in fact.

Thanks xot for having created this site (^^,)

~NervaL928

PS : I'm French, so am I the only one in this case ? If yes, no matter, I'll speak English, as always !

Pages: **1**