Hey there, here's my issue. I'm having some issues using makescreenshot2(). I'm attempting to create a screenshot of a selected size made by the player dragging their mouse in the level. I've got the selecting thing finished, but the makescreenshot2 function isn't behaving as I'd like it to!
Here's the code I'm using.
PHP Code:
//#CLIENTSIDE
function onMouseDown() {
this.opx = int(mousex);
this.opy = int(mousey);
}
This was really another attempt this thread, but I don't want to draw just the tiles.
xXziroXx
06-04-2012 01:18 PM
Well, first of all, you're calling calculateImage() when the function is named CalculateImage(), which in it's own is an error.
You also seem to be using level values rather than screen relative values, which might be the issue - I don't remember how the screenshot commands work exactly.
Emera
06-04-2012 01:26 PM
Quote:
Originally Posted by xXziroXx
(Post 1696362)
Well, first of all, you're calling calculateImage() when the function is named CalculateImage(), which in it's own is an error.
You also seem to be using level values rather than screen relative values, which might be the issue - I don't remember how the screenshot commands work exactly.
calculateImage and CalculateImage will work either way.
The second point sounds like it might fix it thanks for the tip, I'll try it out.
xXziroXx
06-04-2012 03:02 PM
Quote:
Originally Posted by Emera
(Post 1696363)
calculateImage and CalculateImage will work either way.
Even so, it's wrong and shouldn't be practiced.
cbk1994
06-04-2012 09:58 PM
Quote:
Originally Posted by xXziroXx
(Post 1696365)
Even so, it's wrong and shouldn't be practiced.
+1, he's right that it won't actually make a difference (the engine doesn't care) but ambiguity is always bad in code.
DustyPorViva
06-04-2012 10:19 PM
Quote:
Originally Posted by cbk1994
(Post 1696401)
+1, he's right that it won't actually make a difference (the engine doesn't care) but ambiguity is always bad in code.
On top of this, it DOES matter in many languages(like Java) which you may eventually find yourself moving on to after Graal/GS2.
Habits die hard, may as well crush them early.
fowlplay4
06-04-2012 10:22 PM
Quote:
Originally Posted by /scripthelp
makescreenshot2(str, int, float, float, float, int, int) - makes a screenshot without gui, parameters are filename, render bit flags (1 (local player) + 2 (other players) + 4 (npcs) + 8 (particles from removed objects) + 0x10 (weapon showimgs) + 0x20 (daynight effect), or 0x3f for everything), levelx, levely, levelz, pixelwidth and pixelheight
This makes it work as intended:
PHP Code:
//#CLIENTSIDE
function onMouseDown() {
this.opx = int(mousex);
this.opy = int(mousey);
}
function GraalControl.onMouseDragged() {
this.npx = int(mousex);
this.npy = int(mousey);
with (findimg(200)) {
polygon = {
thiso.opx, thiso.opy,
thiso.npx, thiso.opy,
thiso.npx, thiso.npy,
thiso.opx, thiso.npy
};
alpha = 0.45;
}
with (findimg(201)) {
text = thiso.opx SPC "|" SPC thiso.opy;
layer = 5;
x = screenwidth / 2;
y = 10;
style = "c";
}
with (findimg(202)) {
text = thiso.npx SPC "|" SPC thiso.npy;
layer = 5;
x = screenwidth / 2;
y = 30;
style = "c";
}
}
function onMouseUp() {
hideimgs(200, 202);
generateImage();
}
If I was releasing this code to the community (which I'm not) then I would correctly fix it up and what not. I'm only trying to test something out so a lowercase letter doesn't really have to cause so much hassle.
xXziroXx
06-05-2012 01:13 AM
Quote:
Originally Posted by Emera
(Post 1696407)
If I was releasing this code to the community (which I'm not) then I would correctly fix it up and what not. I'm only trying to test something out so a lowercase letter doesn't really have to cause so much hassle.
With that attitude you'll soon learn how we'll suddenly stop responding to your threads in these parts of the forums. :rolleyes:
Fulg0reSama
06-05-2012 01:25 AM
Quote:
Originally Posted by xXziroXx
(Post 1696428)
With that attitude you'll soon learn how we'll suddenly stop responding to your threads in these parts of the forums. :rolleyes:
Although I have no business in this section whatsoever, I think you're not being any better with that response, but I do agree with you, don't get me wrong.
Emera, Try a "thank you".
Ziro, You gave your advice on the matter, simply tip your hat and bow out with the class you entered with.
xXziroXx
06-05-2012 04:03 AM
Quote:
Originally Posted by Fulg0reSama
(Post 1696433)
Although I have no business in this section whatsoever, I think you're not being any better with that response, but I do agree with you, don't get me wrong.
Emera, Try a "thank you".
Ziro, You gave your advice on the matter, simply tip your hat and bow out with the class you entered with.
I was just being brutally honest, far too often people come here and ask questions with scripts without ever wanting to learn. I think I speak for the majority of us when I say that we don't mind giving advice or helping with minor codesnippets, as long as it's actually helpful. In this particular case of Emera, he was told what he doing was wrong and brushed it off like it didn't matter, so of course I will comment on it.
Fulg0reSama
06-05-2012 04:39 AM
Quote:
Originally Posted by xXziroXx
(Post 1696447)
I was just being brutally honest, far too often people come here and ask questions with scripts without ever wanting to learn. I think I speak for the majority of us when I say that we don't mind giving advice or helping with minor codesnippets, as long as it's actually helpful. In this particular case of Emera, he was told what he doing was wrong and brushed it off like it didn't matter, so of course I will comment on it.
Understood.
Now that I've responded to that...
cbk1994
06-05-2012 05:51 AM
Quote:
Originally Posted by xXziroXx
(Post 1696447)
I was just being brutally honest, far too often people come here and ask questions with scripts without ever wanting to learn. I think I speak for the majority of us when I say that we don't mind giving advice or helping with minor codesnippets, as long as it's actually helpful. In this particular case of Emera, he was told what he doing was wrong and brushed it off like it didn't matter, so of course I will comment on it.
A lot of people have had that attitude lately in these forums. Some of them even get mad at the person helping them because what they've said is not directly related to their problem.
I'm not putting Emera in this category, just saying that it's very annoying as a scripter to see people using the forum for quick fixes for their server and not to learn.