[Include] MapDialog: A scripted map - Scroll through a textdraw map with your mouse, zoom, and much more!
#1

Hi,
I was inactive for a while, and didnt release something for an even longer time. But as I noticed some of the new 0.3d features are really handy, I decided to play a bit with them. The result is this include. It combines the new sprite textdraws with an old idea I had to control something with your mouse.

Again I paid much attention to the ability of customization and generalization. This is not a ready-to-use include, but a functional library that adds scripting functions to your script.

What is it?
This include provides a "map dialog". A map dialog is a set of textdraws showing the whole SA map, and some optional info textdraws (controls and position). You can create map dialogs, show and hide them for a player (only one player/dialog) and catch different events. If a map dialog is shown to a player, he can scroll through the map using either the directional keys, or his mouse. You can also zoom in and out, jump to your player position, select a point (more about that later) or - of course exit it.

Update for 0.3d: If you just wanna have a map to get the position the player clicks at, use OnPlayerClickMap from 0.3d, so you just have to use this include if you want to use it for more than just that now.

How to control?
Default keys are:
RMB + mouse / movement keys: scrolling
KEY_FIRE: Select the current position
KEY_YES: Zoom in
KEY_CTRL_BACK: Zoom out
KEY_SPRINT: jump to the player's position
KEY_SECONDARY_ATTACK: exit

Scripting functions
I will only list the functions here. You can read how to use them in the code documentation.
pawn Код:
MapDialog:CreateMapDialog(playerid, usecallback, showposition, showhelp, msg=0);
DestroyMapDialog(MapDialog:dialog);
MapDialogScrollTo2D(MapDialog:dialog, Float:x, Float:y, Float:zoom, bool:init=false);
SetMapDialogVisible(MapDialog:dialog, visible);
GetMapDialogOwner(MapDialog:dialog);
GetZoneNameAt(Float:x, Float:y, name[], size=sizeof(name));
MapDialogSetPlayerPos(MapDialog:dialog, Float:x, Float:y, Float:z);

// Callbacks:
OnMapDialogResponse(MapDialog:dialog, msg, Float:x, Float:y, response);
OnMapDialogNavigation(MapDialog:dialog, msg, Float:oldx, Float:oldy, Float:oldzoom,
                                Float:newx, Float:newy, Float:newzoom);
What to use this for?
There are a bunch of things you can do with this. The most common function would be to replace the map-teleport-trick (allow player teleport on SA map, catch the teleport event, process the location). This works, but I never really liked it, with the MapDialogs you can do it the more native way, without a detour.
Other uses could be easy position spotting, e.g. for placing pickups or cars.
It would take too long to analyse every single possible use, just ask your imagination!

How to use this in your script?
I dont want to tell too much in the section. Basically, include it, and add at least the OnMapDialogResponse callback always returning 1, or your players will get stuck in the dialogs. When setting the player's position in one of the callbacks, dont use SetPlayerPos, as the position is locked and so it wont work. Use MapDialogSetPlayerPos(MapDialog:dialog, Float: x, Float:y, Float:z) instead.
There are also some defines that you can change as you like, should also be quite self-explaining.
I dont think the scripting part needs big explanation, however, Ill add a short example code in the download section.

Known bugs:
  • Sometimes parts of, or the whole map is flickering or lagging. This is probably caused by the way I "stream" the textdraws. However, I couldnt find the reason for it yet.
  • Mouse movement speed might dither. This is caused by the way I detect the movements and can only be reduced by lengthening the update interval.
  • (Not really a bug) A lot of sections in the code are deactivated. This is because I was planning some things that I did not fully implement yet. They might be used in possible future versions.
Possible updates
Depending on how many people are interested in this include I might release some updated versions, so tell me if you find this include useful! I already got a set of ideas, but am not sure if they are useful or not. (e.g. MapIcons, Playermarkers like on the SA map.)

Changelog
0.1b: Removed zone detection due to copyright issues.


Your permissions, Credits
The same thing as for all my scripts.
You are allowed to use this include for your server.
You may modify it as much as you like for private use.
You are not allowed to re-release or sell the original or an edited version without my permission.

If you use this include, or parts of it for your own script, please dont forget to give me some credits in any way.


Links/Download
MapDialog include V0.1b, pastebin (4.11.2011) (ONLY WORKING WITH 0.3D)
Usage examples, pastebin (3.11.2011)
Some screenshots


As always feel free to give some feedback, bug reports, or suggestions
Have fun!
Reply
#2

dude fuckinggggggggggg awesomeeee!!!

rep ++ awesome work, keep it up
Reply
#3

Omg nice!! (:
Reply
#4

Nice work!
Reply
#5

Great use of the new functions
Reply
#6

how man...nice work !
Reply
#7

video please
or at least pictures :$
Reply
#8

Thanks for the feedback!

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
video please
or at least pictures :$
I thought about making a video, but thought it would be quite pointless just to show a moving map
There already are some screenshots in the links section.


Quote:
Originally Posted by ******
Посмотреть сообщение
I find it HIGHLY ironic that you have comments at the top of your file restricting people's redistribution rights to permission only, and yet you have included code from Cueball with no evidence of permission what so ever! Did you ask to use that array and get permission?

Also, using the player looking angle to get mouse movement information was documented months ago
Sorry I dont really get the point of it.

1. Show me a word by Cueball saying that it is forbidden to use the include or parts of it without his permission, and ill remove the array. I added him and the previous contributors to the credits, and marked all sections in the code that I took from his include, so I am quite sure that I didnt do anything wrong, as Cueball himself also used parts of the include from previous releases.

2. I never said mouse movement is unique, or that noone ever thought about that before. I know that you wrote about it a while ago, but I created this absolutely independent from your work. Else I had named you in the credits of course.
Reply
#9

Okay, thats my bad then. I will remove the array and the zone detection then. Maybe ill build an own array, or look for another script with a contactable author later. Thanks for the hint.
Reply
#10

Very nice good work 10/10
Reply
#11

Sorry, this comment is a bit disappointed, I did not want to hurt anyone.

Quote:
Originally Posted by ******
Посмотреть сообщение
There is no mention anywhere else in the script that you are allowed to copy it, and thus IP law and copy protection applies and all copy rights are reserved by the script copyright owner. Unless there is an explicit statement that you ARE allowed to copy it, you aren't, that's the default that "copyleft" licenses go against.
First:
As long as something is not licensed, you can do anything what you want with it.
If it is licensed, and the creator has a copyright holder, you can only do what the license allows you to do.
The Program you have shown does not contain any license informations, only a line saying Copyright SA-MP Team.

Second:
I think this is a very big problem in the SA-MP Scripting Community. Almost everybody makes releases just to fame himself and don't allow others to use it for their wants.
What do you think, why did the authors created the include? Not for other players and scripters to use it?
What is the point in making anything for SA-MP, if others cannot benefit from it? We should support each others, but in reality everybody just make problems about things like this.

SA-MP itself is violating R*'s Terms of Usage. Reverse-engineering the game is illegal and against the Terms.
Why complaining on things when something gets better by an other developer?
This community is meant to help each other, not to show who is the best scripter(,...) and forbid everything from being improved.

What you (and a lot of others) want to introduce here (sadly), is a bad tendency. If we have something, whether it is good or bad, we have two options:
a) Use it as it is
b) Edit for our own goals, or fix bugs in it.
If we choose option 'b', we don't really have a chance to let it available for others who can't make it for himself.
We would have to rewrite it, which - in teory - maybe just different in a few lines, and release it with our own credits. And if we do this, somebody would complain about we 'stolen' the idea(nonsense), and we realise that we worked for nothing.

This is raping Open Source. If we are not allowed to copy things from other scripts, or reverse-engineer a compiled AMX file, we could even just release the compiled script without the source code. It would be the same as now.

We won't be a good community as long as self-interest won't disappear.
I urge every scripter to deliberate this, and start thinking in a community-building mindset before start working on a project what is meant to be on public forums.
Reply
#12

Quote:
Originally Posted by ******
Посмотреть сообщение
If something is copyrighted (and everything is copyrighted from the moment you create it till 70 years after your death, whether you explicitly state so or not) then, by very definition of the word "copyright" you hold the sole copying rights.
That Work is "copyrighted" to SA-MP Team. Are the authors legally belong to "SA-MP Team"?

Quote:
Originally Posted by ******
Посмотреть сообщение
Secondly, I'm not discouraging sharing (all my releases are done under the MPL, a license I chose carefully for it's sharing rights), simply pointing out that this is restricted while using others.
True. I did not want to point on you, I wanted to point out that this is the attitude of a high percent of the community.
Reply
#13

General interest on this seems to be quite low, so I probably wont release further updates. Hope this helps some people anyways.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)