Difference between revisions of "Append"
Jump to navigation
Jump to search
imported>Fredg1 m |
m (Changed "slot" to "slott", because "slot" is reserved in KoLMafia and cannot be used as a key variable name) |
||
Line 26: | Line 26: | ||
buffer gear; | buffer gear; | ||
− | foreach | + | foreach slott in $slots[] |
− | if(equipped_item( | + | if(equipped_item(slott) != $item[none]) { |
if(length(gear) != 0) | if(length(gear) != 0) | ||
gear = append(gear, ", "); | gear = append(gear, ", "); | ||
− | gear = append(gear, to_string(equipped_item( | + | gear = append(gear, to_string(equipped_item(slott))); |
} | } | ||
Latest revision as of 14:21, 8 December 2021
Function Syntax
buffer append(buffer original ,string add )
- original is the buffer to add to
- add is a string to add on
Returns a buffer containing original with add tacked on to the end.
Code Sample
Print a list of all items currently equipped.
buffer gear;
foreach slott in $slots[]
if(equipped_item(slott) != $item[none]) {
if(length(gear) != 0)
gear = append(gear, ", ");
gear = append(gear, to_string(equipped_item(slott)));
}
print("I am wearing: "+ gear);