|
|
|
|
| JASS Resources Find JASS code snippets and functions here or write your own and post it on the Submissions sub-forum. |
 |
|
03-30-2012, 06:13 PM
|
#16 (permalink)
|
|
\m/
Join Date: Oct 2007
Posts: 326
|
With checking for sync I can set CHECK_SPACE_TIME to 0.1 and this will work as your second idea.
I think I will test new code today, but I don't promise.
|
|
|
03-30-2012, 06:35 PM
|
#17 (permalink)
|
|
cool != useful
Join Date: Apr 2008
Posts: 1,940
|
More comments are needed if you set it to 0.1, because users would expect to be more accurate than it is.
Also, i suppose a GetLastTimeSync function wouldn't hurt.
Finally instead of the SpacePressed function it would be better to use a function interface or a custom function with a code argument.
I agree that it is a very specifical use, but "hardcoding" a stuff in a needed library is not a good practice.
Or just use the Event library, as it is afterall a custom event.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.
You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
|
|
|
03-30-2012, 07:36 PM
|
#18 (permalink)
|
|
\m/
Join Date: Oct 2007
Posts: 326
|
Quote:
Originally Posted by Troll-Brain
More comments are needed if you set it to 0.1, because users would expect to be more accurate than it is.
Also, i suppose a GetLastTimeSync function wouldn't hurt.
Finally instead of the SpacePressed function it would be better to use a function interface or a custom function with a code argument.
I agree that it is a very specifical use, but "hardcoding" a stuff in a needed library is not a good practice.
Or just use the Event library, as it is afterall a custom event.
|
Can tell me how to do custom events?
Anyway, code even with checking for sync doesn't work in multiplayer. I don't have any idea...
|
|
|
03-30-2012, 11:31 PM
|
#19 (permalink)
|
|
cool != useful
Join Date: Apr 2008
Posts: 1,940
|
Quote:
Originally Posted by D.O.G.
Can tell me how to do custom events?
Anyway, code even with checking for sync doesn't work in multiplayer. I don't have any idea...
|
I suppose there are some libraries here which use the library Event.
You could take them as an example.
It doesn't work, even with the boolean ?
How it doesn't work btw ?
You could also back to the loop sync (first block of code), because as said i'm not 100 % sure it will work even if it should.
And finally the guy who wrote about the sync stuff could be wrong.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.
You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
|
|
|
03-31-2012, 05:47 AM
|
#20 (permalink)
|
|
User
Join Date: Jul 2007
Posts: 4,920
|
This is coded wrong. When you use spacebar, the player's window goes to that player's start location, not to some point off the screen.
GetStartLocationX(GetPlayerId(GetLocalPlayer())) == GetCameraTargetPositionX() and GetStartLocationY(GetPlayerId(GetLocalPlayer())) == GetCameraTargetPositionY()
It's a quick fix ; ).
Also, be sure to start the start location coords in vars to improve speed and readability a bit ^_^.
Jass:
set x = GetStartLocationX(GetPlayerId(GetLocalPlayer()))
set y = GetStartLocationY(GetPlayerId(GetLocalPlayer()))
Nice attempt for one of your first resources, gj ^)^. +rep.
Be sure to use the Event library for your custom events ; ).
This is the main thing you have to watch out for -> Custom Event Data
|
|
|
03-31-2012, 07:03 AM
|
#21 (permalink)
|
|
ʕ•͡ᴥ•ʔ
Resource & Tutorial Moderator
Join Date: Nov 2006
Posts: 3,561
|
He calls this:
call SetCameraQuickPosition(Space_X, Space_Y)
So the spacebar should go to the point off screen, unless I'm mistaken.
|
|
|
03-31-2012, 07:06 AM
|
#22 (permalink)
|
|
User
Join Date: Jul 2007
Posts: 4,920
|
Ah, my bad =). I've never used that native, so I wasn't sure what it did ;p.
I just knew from experience that spacebar auto returns u to player start locations ^)^
Then all this needs is the event stuff and it's good to go =D.
Spacebar event will be a very useful event to have. It's too bad that it's local only for the moment.
edit
make this use timeout of .031250000 for more accurate event responses please =O. As such, please make this use CTL so that it's merged with other timers of that timeout =). All you need to do is make a TimerGroup ^_^.
|
|
|
03-31-2012, 09:31 AM
|
#23 (permalink)
|
|
cool != useful
Join Date: Apr 2008
Posts: 1,940
|
@D.O.G :
Don't worry using CTL will never be a requirement for that. (In case you don't like/understand the API)
Using one timer for that is enough fine here.
Plus i'm not sure that even in a single player game cameras are that fast.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.
You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
|
|
|
03-31-2012, 09:33 AM
|
#24 (permalink)
|
|
User
Join Date: Jul 2007
Posts: 4,920
|
Awww, this is all u need
call TimerGroup32.create(function Actions).start()
You can get rid of your trigger and everything ;o.
|
|
|
03-31-2012, 09:36 AM
|
#25 (permalink)
|
|
cool != useful
Join Date: Apr 2008
Posts: 1,940
|
CTL is ugly to use for many of us :
Quote:
|
Originally Posted by myself
In case you don't like/understand the API
|
Plus, you can't get rid of the trigger action, at least not with the sync version.
EDIT : But yeah for SpaceHandlerLocal you don't need a trigger, only a timer.
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.
You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
|
|
|
03-31-2012, 10:43 AM
|
#26 (permalink)
|
|
User
Join Date: Jul 2007
Posts: 4,920
|
Oh yea, this actually won't need recursive events. I don't see a spacebar event ever happening within a spacebar event, so you don't need to worry about the recursive stuff ;D.
|
|
|
03-31-2012, 02:11 PM
|
#27 (permalink)
|
|
\m/
Join Date: Oct 2007
Posts: 326
|
I'm not going to use your CTL. It doesn't add something to functionality of my snippet and is useless there. Also I don't want my snippet has any requirements
Last edited by D.O.G.; 04-08-2012 at 03:16 PM.
|
|
|
04-08-2012, 10:57 AM
|
#28 (permalink)
|
|
\m/
Join Date: Oct 2007
Posts: 326
|
Added working multiplayer version.
|
|
|
04-08-2012, 01:09 PM
|
#29 (permalink)
|
|
cool != useful
Join Date: Apr 2008
Posts: 1,940
|
So StoreReal with GetLocalPlayer doesn't work, you have to do a loop ?
That doesn't really make sense, because with or without the loop it's already used in a local block for each player.
Or have you done it just to be sure ?
__________________
- There are bugs with wc3, but most of time, the bug is between the keyboard and the chair.
- Never believe some warcraft "fact" without a proof, even from an "experienced" user, that's how myths & legends born.
You spam "...", "lol", and smilies such as "; p", "^)^",">.>"? You think you're the best and all other ones are stupids or at least less clever than you ? You think your errors are funny, while the other ones are incredibly lame ?
Maybe you've too much ego,or worse, you're a douchebag
|
|
|
04-08-2012, 03:15 PM
|
#30 (permalink)
|
|
\m/
Join Date: Oct 2007
Posts: 326
|
Quote:
Originally Posted by Troll-Brain
So StoreReal with GetLocalPlayer doesn't work, you have to do a loop ?
That doesn't really make sense, because with or without the loop it's already used in a local block for each player.
Or have you done it just to be sure ?
|
I've made it to be sure. I have tested - current version (4.0) works 100% with 2 players (must work with more players).
EDIT: I've added untested version without loops. Hopefully, I could test it tonight.
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|
All times are GMT. The time now is 05:05 PM.
|