Trying to define a resource from a varable rather than a string literal. What's the correct syntax? Where can I find an updated script guide (I haven't been in a BioWare tool kit since NWN).
In other words:
resource r = R"my_res_ref.uti"; // compiles normally
but how to use a variable:
resource r = R"" + sVar + ".uti"; // throws an error
Thanks
Script syntax? resource r = R + filename_variable.
Débuté par
_ShadowHawk
, nov. 15 2009 05:29
#1
Posté 15 novembre 2009 - 05:29
#2
Posté 17 novembre 2009 - 06:44
Did you figure how to do it, if that's possible ?
I also tried to find out how to simply extract the resource from existent items, but to no avail.
If anyone knows, well, please.
I also tried to find out how to simply extract the resource from existent items, but to no avail.
If anyone knows, well, please.
#3
Posté 17 novembre 2009 - 08:30
Couldn't find anything either. Just spitballing here so try
resouce r = R( sVar +".uti" );
resouce r = R[ sVar +".uti" ];
resouce r = R{ sVar +".uti" };
resouce r = R"\\"" +sVar +".uti" +"\\""; // ha ha if this one works, should be only one backslash.
resouce r = R( sVar +".uti" );
resouce r = R[ sVar +".uti" ];
resouce r = R{ sVar +".uti" };
resouce r = R"\\"" +sVar +".uti" +"\\""; // ha ha if this one works, should be only one backslash.
Modifié par Axe_Murderer, 17 novembre 2009 - 08:40 .
#4
Posté 17 novembre 2009 - 09:22
What we actually need is the omitted StringToResource function so you can:
resource rMyItem = StringToResource("myitem.uti");
Modifié par Sunjammer, 17 novembre 2009 - 09:23 .
#5
Posté 17 novembre 2009 - 10:54
I realized that immediately and it would be perfect, but Georg et al have their hands full right now without being asked to code a new function.Sunjammer wrote...
What we actually need is the omitted StringToResource function so you can:resource rMyItem = StringToResource("myitem.uti");
(i.e. My game is among those crashing at random 5 to 10 minute intervals.)
So I guess I'll keep tinkering in the mean time.
#6
Posté 18 novembre 2009 - 07:36
None of these work I'm sorry to say.Axe_Murderer wrote...
Couldn't find anything either. Just spitballing here so try
resouce r = R( sVar +".uti" );
resouce r = R[ sVar +".uti" ];
resouce r = R{ sVar +".uti" };
resouce r = R"\\\\"" +sVar +".uti" +"\\\\""; // ha ha if this one works, should be only one backslash.
#7
Posté 18 novembre 2009 - 09:46
Er... If:
resource r = R"my_res_ref.uti"; // compiles normally
but:
resource r = R"" + sVar + ".uti"; // throws an error
did you try:
resource r = R"" + sVar;
Or are you setting sVar yourself and know that it does not have the extension?
resource r = R"my_res_ref.uti"; // compiles normally
but:
resource r = R"" + sVar + ".uti"; // throws an error
did you try:
resource r = R"" + sVar;
Or are you setting sVar yourself and know that it does not have the extension?
#8
Posté 18 novembre 2009 - 10:33
Found a lil' something while cruising through creature_core. Hm ? No, it wasn't what I was looking for, tho, but that's not the point. <_<
Some types of object contain resources within their local variables, for example the placeables used as traps. And as long as there's a var somewhere it's easy to use it :
resource rTrap = GetLocalResource(oPettyPlaceable, "PLC_TRAP_ITEM");
DisplayFloatyMessage(GetHero(), "Gotcha: "+ResourceToString(rTrap), FLOATY_MESSAGE, 0xFFFFFF);
While such a local variable doesn't exists for items, one can add a new var through MD2A and put the resource there when the item initially spawn. (via events if there's one appropriate, or manually)
It ain't perfect, but well, it's better than naught.
Some types of object contain resources within their local variables, for example the placeables used as traps. And as long as there's a var somewhere it's easy to use it :
resource rTrap = GetLocalResource(oPettyPlaceable, "PLC_TRAP_ITEM");
DisplayFloatyMessage(GetHero(), "Gotcha: "+ResourceToString(rTrap), FLOATY_MESSAGE, 0xFFFFFF);
While such a local variable doesn't exists for items, one can add a new var through MD2A and put the resource there when the item initially spawn. (via events if there's one appropriate, or manually)
It ain't perfect, but well, it's better than naught.
Modifié par Phaenan, 18 novembre 2009 - 10:38 .





Retour en haut






