Page 1 of 121

OLD Wolph42's 'Drop-in' Bag of MT Tricks OLD

Posted: Fri Sep 10, 2010 10:31 am
by wolph42

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 11:25 am
by jfrazierjr
Cools stuff! Make more better easier....heh..

Also, perhaps you could create a "trap" builder macro....

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 1:29 pm
by wolph42
jfrazierjr wrote:Also, perhaps you could create a "trap" builder macro....

_˅_
. |
¯¯¯

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 1:34 pm
by plothos
wolph42 wrote:
jfrazierjr wrote:Also, perhaps you could create a "trap" builder macro....

_˅_
. |
¯¯¯
Hey, didn't you know? Doing something only proves you can do more stuff! :)

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 2:39 pm
by wolph42
plothos wrote:
wolph42 wrote:
jfrazierjr wrote:Also, perhaps you could create a "trap" builder macro....

_˅_
. |
¯¯¯
Hey, didn't you know? Doing something only proves you can do more stuff! :)
<hmpfff>

attached is an update with the option to teleports to other maps as well.
This works exactly the same except that you need to set the OTHER map name in the tokenproperties of the inter teleport token.
It also has the option to create teleports on other maps as well.
...and it now also centres correctly on the new teleport...

This works slightly more complicated as the first version, as every map now has its own UDF, which needs to be created and put in the onCampaignLoad

</hmpfff>

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 3:17 pm
by jfrazierjr
Soo... I can expect the trap builder by the end of the weekend? :mrgreen:

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 4:12 pm
by jfrazierjr
I just played with this. Good stuff!! but I can't help but think it could be simpler. For example, select two tokens(assuming they stay on the same map) and run macro that uses getselected to "link" two tokens by setting it's partner into a property together(perhaps with a dialog that asks to select map names for both to "teleport" to(or keep same map). Perhaps keeping the list of teleporters in a json array on the Lib::Token to see if the token ended it's movement on it? Anyway, just a thought.

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 4:42 pm
by jfrazierjr
wolph42 wrote:Admittantly I was hopping on my seat when I figured this out.
Conceived problem:
jfrazierjr created the nice onTokenMovement patch for e.g. traps and teleports
Well heck.. if my patch is a problem, perhaps I should take it out. :P

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 6:39 pm
by wolph42
jfrazierjr wrote:I just played with this. Good stuff!! but I can't help but think it could be simpler. For example, select two tokens(assuming they stay on the same map) and run macro that uses getselected to "link" two tokens by setting it's partner into a property together(perhaps with a dialog that asks to select map names for both to "teleport" to(or keep same map). Perhaps keeping the list of teleporters in a json array on the Lib::Token to see if the token ended it's movement on it? Anyway, just a thought.
Maybe. But not Sure. First of the fact that you only need to copy paste is very very simple. And as for the internal teleport. You do need to create separate udf's cause else you'll get errors while mt starts looking for tokens that do not exist.

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 6:40 pm
by wolph42
jfrazierjr wrote:
wolph42 wrote:Admittantly I was hopping on my seat when I figured this out.
Conceived problem:
jfrazierjr created the nice onTokenMovement patch for e.g. traps and teleports
Well heck.. if my patch is a problem, perhaps I should take it out. :P
Yes that is a problem... :P o thee twister of words...

Re: Cewl feat: fully auto teleports

Posted: Fri Sep 10, 2010 6:55 pm
by jfrazierjr
wolph42 wrote:Maybe. But not Sure. First of the fact that you only need to copy paste is very very simple. And as for the internal teleport. You do need to create separate udf's cause else you'll get errors while mt starts looking for tokens that do not exist.
Ok.. Forgive my ignorance since I have mainly let others do macro framework stuff, but why do you need the udfs per map at all? I guess I was thinking about a general macro that onTokenMove() calls passing in the path in the args and that macro does all of the lookups and stuff from a json stored on a lib token. Perhaps I am just way under thinking this all since as I say, I don't really know the macro language super duper well.

As for the copy/paste, yea, that is simple with the proviso that you have to change your token numbering scheme if you do like I do and have random numbers as well as make sure the tokens have a specific name base. Granted, this is less work if it's done right, but I think if the other way can be made to work, it would be easier to document as a set of macros.

Re: Cewl feat: fully auto teleports

Posted: Sat Sep 11, 2010 3:04 am
by wolph42
The big trick is that you can set the teleport pads as (invisible) objects. This has the benefit that you can deform the base e.g. A landingstrip and the name is irrelevant (well it is for the code but not for the map.
2.

Re: Cewl feat: fully auto teleports

Posted: Sat Sep 11, 2010 4:22 am
by Cweord
It would involve some extra work on other maps, but this would work well for buildings and floors.

You wouldn't be able to fight across different levels, but otherwise it should work (till 1.4 if it has multi level support

Re: Cewl feat: fully auto teleports

Posted: Sat Sep 11, 2010 4:26 am
by wolph42
Cweord wrote:It would involve some extra work on other maps, but this would work well for buildings and floors.

You wouldn't be able to fight across different levels, but otherwise it should work (till 1.4 if it has multi level support
There is another post here with multimap support. So that's also already done. I'll update the first post later.

Re: Cewl feat: fully auto teleports

Posted: Sat Sep 11, 2010 8:25 am
by wolph42
I'm in need of some help:

first of I noticed iced that multiple tokens transport does work within a map but not in between maps, though I think I know the solution for that.
What I can't figure out, is the fact that a 'pause' is needed after the transport to another map has taken place, to get the coordinates for the 'arrival' pad. Somehow if I do it directly they're not received. Does anyone know why and better yet, how to solve this pickle?
This is the routine: CurrentX and Y are the coordinates of the token when on the departure pad. newX and Y == offsetCentreX and Y if I don't use te pause (which is wrong).
[h:'<!--Teleports Starts A to B-->']
[h, for(i,1,numInterPads+1), CODE:{
[teleportStartName = "interPad " + i]
[teleporterTriggered = movedOverToken(teleportStartName,lastPath)]
[if(json.contains(teleporterTriggered,currentLocation)), CODE:{
[Token(teleportStartName): newMap = pairedMap]
[teleportEndName = "interPad " + i]

[Token(teleportStartName): offsetCentreX = CurrentX - coordX]
[Token(teleportStartName): offsetCentreY = CurrentY - coordY]

[moveTokenToMap(currentTok, newMap, 0, 0, 0)]
[setCurrentMap(newMap)]

[Token(teleportEndName): endCentreX = coordX]
[Token(teleportEndName): endCentreY = coordY]
[NewX = endCentreX + offsetCentreX]
[NewY = endCentreY + offsetCentreY]

[h:'<!--The pause is necessary, or the new coords wont be set-->']
[Text = "Entering map: "+newMap]
[pause("Text")]

[moveToken(NewX, Newy , 1 )]
[goto(currentTok)]
[abort(0)]
};{}]
}]