I need to remove from inventory any item (equiped or not) that has the beggining tag line of 'summoned_'
summoned_water
summoned_bandages
How can I check for partial tag name?
Check for partial tag name?
Débuté par
Buddywarrior
, mars 27 2012 05:54
#1
Posté 27 mars 2012 - 05:54
#2
Posté 27 mars 2012 - 06:47
object oItem = GetFirstItemInInventory (oPC);
while (GetIsObjectValid (oItem) )
{
if (GetStringLeft(GetTag (oItem),9) == "summoned_") DestroyObject (oItem);
oItem = GetNextItemInInventory(oPC);
}
while (GetIsObjectValid (oItem) )
{
if (GetStringLeft(GetTag (oItem),9) == "summoned_") DestroyObject (oItem);
oItem = GetNextItemInInventory(oPC);
}
#3
Posté 27 mars 2012 - 06:47
Try something like
if (GetStringLeft(sTag, 9) == "summoned_") {
/remove it
}
where sTag is the tag of an item.
if (GetStringLeft(sTag, 9) == "summoned_") {
/remove it
}
where sTag is the tag of an item.
#4
Posté 27 mars 2012 - 06:56
A simple example:
void main()
{
object oItem; //however defined
string sTag = GetTag(oItem);
string sCheck = GetStringLeft(sTag, 8);
if (sCheck == "summoned")
{
//destroy object
}
}
Edit: Haha. looks like a few decided to answer at the same time. I'm a little late.
void main()
{
object oItem; //however defined
string sTag = GetTag(oItem);
string sCheck = GetStringLeft(sTag, 8);
if (sCheck == "summoned")
{
//destroy object
}
}
Edit: Haha. looks like a few decided to answer at the same time. I'm a little late.
Modifié par GhostOfGod, 27 mars 2012 - 06:57 .
#5
Posté 28 mars 2012 - 01:29
Thanks a ton guys. So glad that you guys still keep these forums alive. Still the best game to date imo.
Modifié par Buddywarrior, 28 mars 2012 - 01:29 .
#6
Posté 30 mars 2012 - 03:09
GhostOfGod wrote...
A simple example:
void main()
{
object oItem; //however defined
string sTag = GetTag(oItem);
string sCheck = GetStringLeft(sTag, 8);
if (sCheck == "summoned")
{
//destroy object
}
}
Edit: Haha. looks like a few decided to answer at the same time. I'm a little late.
Yes but your code is a complete script, which means you aren't lazy.
#7
Posté 30 mars 2012 - 07:35
Heh, name calling already, you're just upset you didn't get to put your answer in at the same time as the rest of us 
And FWIW, GhostOfGod's script isn't really "complete" either, now is it?
And FWIW, GhostOfGod's script isn't really "complete" either, now is it?





Retour en haut






