Sending Info to scripts

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
kkcahdcakcyt
Sergeant
Posts: 71
Joined: Wed Aug 03, 2005 11:16 pm

Sending Info to scripts

Post by kkcahdcakcyt »

ok i'm trying to make one of my custom maps compatible with mefy's custom map mods.

So far so good except for the bases. All other custom map .scr have this

waitthread command to base.scr::addbasepair "xxxxx xxxx xxx xxx" "xxxx xxxx xxx xxx"

(the xxxx are a number). I'm wondering would it then be sending the information the thread in the base.scr, because next to the thread there is this

addbasepair local.alpos local.axpos local.altype local.axtype local.alangles local.axangles


But that doesn't seem right because the amount of info doesn't add up to the number of variables.

Basically Does anyone know what those numbers next to the addbasepair call is? are they coord? or just info being sent to the addbasepair thread....
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

not sure what you mean, if you're asking about passing parameters, it goes like this.

Code: Select all

thread1:

thread thread2 1 2 5

end

thread2 local.a local.b local.c:

iprintln "You passed..."
iprintln "a: " local.a
iprintln "b: " local.b
iprintln "c: " local.c
iprintln "To thread2"

end
these two would print

You passed...
1
2
5
To thread2

on the screen.

How it works is the numbers after thread <threadname> are what are passed to corrosponding fields in the threadname. I'm not sure if illegal parameters are actually legal (in other words if MOH just gives a warning or if it gives a fullout error when it touches this point), so it could be that the description of addBasePairs is just old and they dont need one of the values listed.

Sorry if this isn't what you meant. :oops:
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

see the bottom of this thread

http://dynamic.gamespy.com/%7Emap/mohaa ... hp?t=10964

basically ur threading it with the valuse u want to pass and then in the new thread before the : ya add local.angle local.origin etc

it has to be in the same order
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

In your case, local.alpos and local.axpos will become the numbers you specified... all other variables will just be NIL.
Image
mefy
Corporal
Posts: 33
Joined: Tue Oct 21, 2003 2:57 am

Post by mefy »

The first two parameters are required and the rest are optional.

Code: Select all

addbasepair local.alpos local.axpos local.altype local.axtype local.alangles local.axangles 
alpos is the position string of the allied base
axpos is the position string of the axis base
altype is the type of allied base (default is a player model)
axtype is the type of axis base (default is a player model)
alangles is the exact angles of the allied base (default is ( 0 yaw 0 ) where yaw is the angle you specified in the position string)
axangles is the exact angles of the axis base (default is ( 0 yaw 0) where yaw is the angle you specified in the axis position string)

Altype and axtype are used if you want a different kind of base (like a tank or flak cannon).

Alangles and axangles are used when you have a vehicle base that needs to be properly tilted to make it look right when it sits on the terrain.

See the stock map scripts (like mohdm2.scr) where these are used.
New Gametypes for Medal of Honor
Capture-The-Flag | Freeze-Tag | Demolition
www.planetmedalofhonor.com/mefy
kkcahdcakcyt
Sergeant
Posts: 71
Joined: Wed Aug 03, 2005 11:16 pm

Post by kkcahdcakcyt »

holy crap its mefy..... :shock: I considre you a genius lol ( and really patient, i get quit frustrated with this scripting!)

so...

addbaspair "x y z angle" "x y z angle"


and those two position strings coordinate to the variable alpos and axpos thus the others are left blank?
mefy
Corporal
Posts: 33
Joined: Tue Oct 21, 2003 2:57 am

Post by mefy »

Yes but you should give a description of the base too:

Code: Select all

waitthread global/libmef/bases.scr::addbasepair "x y z angle desc" "x y z angle desc"
See the tutorial for more info:
http://mefymods.clan-dwr.com/viewtopic.php?t=23
New Gametypes for Medal of Honor
Capture-The-Flag | Freeze-Tag | Demolition
www.planetmedalofhonor.com/mefy
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

mefy i actually have a question to u about that.

In ur script u thread it with 2 arrays. Yet in your thread ur sending to there is more then one variable. even though u sent 2. so my question to u is

when threading something with an array size of 3. Can u name the thread

Code: Select all

thread_tocall local.a local.b local.c:
and that would break up the array?

i know u can

thread and with an aray of 4 then in the thread have something like
(an origin then an angle)

Code: Select all

thread_tocall local.a:
local.origin[1] = local.a[1]
local.origin[2] = local.a[2]
local.origin[3] = local.a[3]
local.angle = local.a[4]
but does the other way work to break it up or no?
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

The answer is no. arrays are only really handy ways of keeping data stored in one place under one name. It doesn't really do anything else afaik.

each member of an array is a separate value like anything else.

Although i've never tried sending arrays as a whole to a thread, you can do it in high-level languages like C++ and Java, but in MOH i sorta doubt it.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
mefy
Corporal
Posts: 33
Joined: Tue Oct 21, 2003 2:57 am

Post by mefy »

Arrays are passed by reference. A thread will not automatically "break up" the array's elements into each of its parameters. Keep in mind the keys of the array aren't necessarily numbers and so breaking up doesn't really make any sense. You have to address each element that you want.
In ur script u thread it with 2 arrays. Yet in your thread ur sending to there is more then one variable. even though u sent 2. so my question to u is
You'd have to show me what you're looking at because I think you're misinterpreting it.
New Gametypes for Medal of Honor
Capture-The-Flag | Freeze-Tag | Demolition
www.planetmedalofhonor.com/mefy
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

Code: Select all

	waitthread global/libmef/bases.scr::addbase local.seteam " -898  904  496.13    -90 South Bldg Top Level"
and in addbase

Code: Select all

addbase local.team local.pos local.type local.angles
see how ur setting 1 set of "" and the local.team. in the thread name ya got more than 2 where do they come from


OR do they just come out as NIL and ya get the data from somewhere else...
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
mefy
Corporal
Posts: 33
Joined: Tue Oct 21, 2003 2:57 am

Post by mefy »

They'll just be NIL. Those are optional parameters like I explained in my first post. Also there's no arrays being passed. The position string is parsed later on.
New Gametypes for Medal of Honor
Capture-The-Flag | Freeze-Tag | Demolition
www.planetmedalofhonor.com/mefy
GiffE1118
Warrant Officer
Posts: 137
Joined: Fri Aug 05, 2005 12:14 am
Contact:

Post by GiffE1118 »

ah i got it now then :D
just mis interpreted
www.95thDivision.com
Image

BOTTOM 125th Poster! lol
Post Reply