Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: NoMAtter on August 21, 2013, 09:53:39 am

Title: Drawing Shapes via Script
Post by: NoMAtter on August 21, 2013, 09:53:39 am
Script Name: Just DrawCircle Function
Script Description: Just draws a circle
Original Author(s): NoMatter
Core Version: 2.7.5

procedure DrawCircle(ID, Num: byte; Delay: integer; Colour: longint; Scale: single; x, y, radius: integer);

Parameter Info:
 
 ID (Byte): Player ID to draw the circle to. Set to 0 to drawto all players.
 Num (Byte): Function will use DrawTextEx layers starting from this number. (If you are using layers until 99, assign this Num 100 to make it use free layers)
 Delay (Integer): Time in milliseconds for the circle to remain on screen.
 Colour (Longint): Colour the circle should be when drawn to the screen.
 Scale (Single): Scale to use for drawing, line width.
 x (Integer): X position for the text. 1 -> 640
 y (Integer): Y position for the text. 1 -> 480
 radius (integer): Radius of the circle.


When i tried to draw a circle by just writing "o" with DrawText but it didnt work. "o" is actually a square in soldat's font :D So i decided to make this function. I converted an algorithm that i use in c. And then i realized we can draw all the shapes in soldat screen. I mean, DrawTriangle and DrawEllipse etc. will be here if you guys want :)

But there are some bugs with DrawCircle. Since there is 255 layers to use, it can draw limited-size circle. The biggest circle you can draw must be at maximum 47 radius.

Here's a screenshot from the circle
(http://i.imgur.com/yJJNLUR.png?1)


Title: Re: Drawing Shapes via Script
Post by: NoMAtter on August 21, 2013, 05:33:00 pm
heh... It could be used as a radar skill in some realistic mode games xD like /showenemy :]
Can be used in a mod like you say.
Title: Re: Drawing Shapes via Script
Post by: Mighty on August 26, 2013, 03:07:04 pm
heh... It could be used as a radar skill in some realistic mode games xD like /showenemy :]
That's actually impossible because you'd have to either draw on terrain, on map, or at least know player's cursor's position.
Or am I actually wrong and it's possible and I'm just too sleepy?

Also I believe writeln(inttostr(k)); should be commented?

Edit: also, I found the highest working as intended radius to be 43 starting from layer no 2. Any higher number causes a Byte value loop and layers start to overwrite, also showing at in-game console.
Title: Re: Drawing Shapes via Script
Post by: NoMAtter on August 27, 2013, 04:39:04 am
That's actually impossible because you'd have to either draw on terrain, on map, or at least know player's cursor's position.
Or am I actually wrong and it's possible and I'm just too sleepy?
Yes, it is not possible without knowing the cursor's coordinates.

Also I believe writeln(inttostr(k)); should be commented?
Oh, i forgot that line. I put it to trace it.

Edit: also, I found the highest working as intended radius to be 43 starting from layer no 2. Any higher number causes a Byte value loop and layers start to overwrite, also showing at in-game console.
It can be right. I didnt work much on it. But it can be developed.
Title: Re: Drawing Shapes via Script
Post by: dominikkk26 on November 30, 2013, 09:25:49 am
Combining this with moveplayer, you could do even plane in soldat xD
Title: Re: Drawing Shapes via Script
Post by: Bonecrusher on November 30, 2013, 09:29:13 am
That would be impressive