space component short name
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
space component short name
I was wondering if it is possible to get the shortname of a space component via ai/md. In lua, you could use <GetComponentData(spaceid, "mapshortname")> to get it, but I would like to have this information in an md script. is there a way I do not see?
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
Only thing I have found so far would be to create a menu whose onShow function would consist only of filling variables with values and then to pass these as parameters to a new section. It's a workaround, but sadly this is a bit limited, as it e.g. will not quite work if a menu is already open. I have not tried the <raise_lua_event> bit, but as I understand them, they only work if a menu is already shown to alter data shown.
-
- Posts: 3614
- Joined: Sun, 8. Apr 12, 09:40
-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
yes, I have found the readtext values as well, but It would be quite ungeneric to just list them all myself (or not really possible for zones), especially since they are defined as "properties/map/@shortvariation" in the clusters/sectors macro definitions, or the "properties/map/@index" for zones respectively (I think). It would be great if we could have more of the options from GetComponentData in md/ai as well. Although, for the short term I would be happy with just the shortvariations retrievable from md/ai 
edit: I think it could also be nice to have lua as some kind of "library" in md so we can just call it to use the lua-specific functions and return data to the md script.

edit: I think it could also be nice to have lua as some kind of "library" in md so we can just call it to use the lua-specific functions and return data to the md script.
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
@shortvariation can also apply to Zones and would be preffered over @index if set - in vanilla this feature is unused though..Phipsz wrote:yes, I have found the readtext values as well, but It would be quite ungeneric to just list them all myself (or not really possible for zones), especially since they are defined as "properties/map/@shortvariation" in the clusters/sectors macro definitions, or the "properties/map/@index" for zones respectively (I think). It would be great if we could have more of the options from GetComponentData in md/ai as well. Although, for the short term I would be happy with just the shortvariations retrievable from md/ai![]()
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
Scriptproperties.html also applies to md-scropts, in fact there are a few exclusive for md - and gettimg this value would make most sense as property, not as command.Phipsz wrote:can @shortvariation be accessed from md though? scriptproperties says nothing about that sadly...
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
I know scriptproperties applies to md/ai and not ui. what I meant was: scriptproperties gives no information about if the shortvariation can be accessed. say, I have a variable "$cluster" holding a clusterid. can I access the shortvariation of the cluster with any property? I tried $cluster.shortname, $cluster.shortvariation, $cluster.macro.shortname, $cluster.macro.shortvariation, $cluster.macro.property.*, $cluster.macro.map.*, $cluster.map.* and $cluster.property.* with none of them resolving.UniTrader wrote:Scriptproperties.html also applies to md-scropts, in fact there are a few exclusive for md - and gettimg this value would make most sense as property, not as command.Phipsz wrote:can @shortvariation be accessed from md though? scriptproperties says nothing about that sadly...
EDIT: OK, I got it working now with RegisterEvent in lua and raise_lua_event. the code for the "menu" is actually really simple:
Code: Select all
local blackboardEntity = nil
local function get_map_shortname(space)
return GetComponentData(space, 'mapshortname')
end
local function event_handler(_, space)
local names = GetNPCBlackboard(blackboardEntity, "$phipsz_map_short_names") or {}
names[ConvertStringToLuaID(space)] = get_map_shortname(space)
SetNPCBlackboard(blackboardEntity, "$phipsz_map_short_names", names)
return
end
local function entity_setter(_, entity)
blackboardEntity = entity
return
end
local function init()
RegisterEvent("phipszGetMapShortname", event_handler)
RegisterEvent("phipszSetRenameEntity", entity_setter)
return
end
init()
return
next, I use signal_cue_instantly with param="$space" so I can get access to the shortname that has been stored in the table of the entity blackboard. thanks for all your help here

