Author Topic: Draw Text on Map and Cursor Position  (Read 2181 times)

0 Members and 2 Guests are viewing this topic.

Offline Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Draw Text on Map and Cursor Position
« on: August 25, 2012, 12:20:11 am »
Hey, it would be very useful to me to have a variant of DrawTextEx (maybe call it DrawMapText) that used XY position relevant to the map rather than the player's screen. This was in Script Core v3 and could be used, for example, to have small text above player's heads. Again, this function would be extremely useful to me for my next script and would be nice to have in 1.6.4.

While I'm talking about player's screens and map positions, I would also like to suggest a new function:

procedure GetCursorXY(ID :Byte; var X, Y :Single);

ID: Player ID to return the cursor coordinates of.
X, Y: Variables which will hold the cursor's coordinates.

This function will return the current XY position of Player(ID)'s cursor. It would add a great extra level of interaction between Players and scripts. This one would probably require changing Soldat so that it sends the cursor position to the server.

Offline Shoozza

  • Retired Soldat Developer
  • Veteran
  • ******
  • Posts: 1632
  • Soldat's Babysitter
    • Website
Re: Draw Text on Map and Cursor Position
« Reply #1 on: August 25, 2012, 06:15:27 am »
The position of the cursor is unknown to the server therefor we cannot make a function for the scriptcore.
Do you know how the DrawText function for map coordinates looked like in the scriptcore?
Rules
Tools: ARSSE - SARS - SRB - chatMod

Offline Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: Draw Text on Map and Cursor Position
« Reply #2 on: August 25, 2012, 07:19:55 am »
The position of the cursor is unknown to the server therefor we cannot make a function for the scriptcore.
I already made this point:
Quote
This one would probably require changing Soldat so that it sends the cursor position to the server.
It's not impossible, software is limited only by hardware. It should not be hard to send 8 bytes of information from the client to the server and, if it is, then Soldat's code is even worse than I imagined.

Do you know how the DrawText function for map coordinates looked like in the scriptcore?
I believe it looked exactly the same as DrawTextEx does(except XY are Singles) , I don't remember what the name of it was though.
Something like this: procedure DrawMapText(ID, LayerID: Byte; Text: String; Delay: Integer; Colour: Longword; Scale, X, Y: Single);
Example code:
Code: [Select]
var
X, Y:single;
begin
 GetPlayerXY(1, X, Y);
 DrawMapText(0, 2, 'P1', 300, -1, 0.06, X, Y-15); //Will show P1 above Player 1's head
end;


Offline Shoozza

  • Retired Soldat Developer
  • Veteran
  • ******
  • Posts: 1632
  • Soldat's Babysitter
    • Website
Re: Draw Text on Map and Cursor Position
« Reply #3 on: August 25, 2012, 10:35:06 am »
Well it can be changed but why should we add this if nothing uses the mouse position.
Soldat would have to send it all the time just for your script.
Rules
Tools: ARSSE - SARS - SRB - chatMod

Offline Tehbugerz0r

  • Soldier
  • **
  • Posts: 158
Re: Draw Text on Map and Cursor Position
« Reply #4 on: August 25, 2012, 11:07:36 am »
Nothing uses it because it hasn't been added yet, but I can imagine the ability to have CreateBullet shoot bullets in the direction of your mouse would be very popular, such an awesome script improvement is worth the harmless 8 bytes, even if you had to limit it to be less responsive, something is better than nothing.

The scripting community may seem small right now but that's only because the whole soldat community has shrunk, assuming I'm the last person scripting would not only be wrong but would suggest you don't believe the scripting community will ever bounce back.

The fact is that many script focused servers can get huge player counts if done well, the fact that the players of those servers aren't very vocal on these forums doesn't mean they are a minority.

Also I'm pretty sure NSC made plenty of edits to the Soldat code purely for Script Core, which may be the only thing people didn't complain about him doing.

Regardless of what you choose, what about the other function? (A response to the other half of my message would be nice.)
« Last Edit: August 25, 2012, 11:33:56 am by Tehbugerz0r »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Draw Text on Map and Cursor Position
« Reply #5 on: August 25, 2012, 03:13:59 pm »
Old map/interface text/image functions will most likely not make it to the next release as there's no enesce's handling code there and i'm working on something else, so i might run out of time. Same goes to GetCursorXY().
From what i've heard from Shoozza i conclude that i could provide you with angle of player's weapon, perhaps that'd be sufficient for you.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.