Author Topic: Drawing Shapes via Script  (Read 1781 times)

0 Members and 1 Guest are viewing this topic.

Offline NoMAtter

  • Major(1)
  • Posts: 15
    • Soldat Arena
Drawing Shapes via Script
« 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




Offline NoMAtter

  • Major(1)
  • Posts: 15
    • Soldat Arena
Re: Drawing Shapes via Script
« Reply #1 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.

Offline Mighty

  • Camper
  • ***
  • Posts: 276
Re: Drawing Shapes via Script
« Reply #2 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.
« Last Edit: August 26, 2013, 03:21:16 pm by Mighty »
xFire: macmil        e-mail: macekmil@gmail.com
My scripts: Accuracy Script       Flashbang       Punishments GUID
            CatchMe Gamemod       AntiFake
            CW System             AntiFakeGUID

Offline NoMAtter

  • Major(1)
  • Posts: 15
    • Soldat Arena
Re: Drawing Shapes via Script
« Reply #3 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.

Offline dominikkk26

  • Camper
  • ***
  • Posts: 404
    • PMGsite
Re: Drawing Shapes via Script
« Reply #4 on: November 30, 2013, 09:25:49 am »
Combining this with moveplayer, you could do even plane in soldat xD

Offline Bonecrusher

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1397
  • High above
    • Zabijaka.pl
Re: Drawing Shapes via Script
« Reply #5 on: November 30, 2013, 09:29:13 am »
That would be impressive

Im chill like that