Get object values
Closed this issue · 8 comments
Hey its me again =/ , can you help me again ?
now i'm trying to study jungle path so do you know a way how that i can get x and y values inside the object ? (image)
thats my code , thanks !
<?php
$time = $api->getMatchTimeline("123456");
foreach ($time as $timeline) {
foreach ($timeline->participantFrames as $frames) {
if ($frames->participantId == "7") {
echo '<pre style=color:white>';
print_r($frames->position) ;
'</pre>';
}
}
}
?>
Hey there! I don't know what exactly you mean.
i want to access all x and y values from the entire match timeline , and in the future do a heatmap for the jungle path.
Well, x
and y
are both just fields of the corresponding API object class so you can access them trivially by using $frames->position->x
.
Well,
x
andy
are both just fields of the corresponding API object class so that you can access them trivially by using$frames->position->x
.
i already tried this but i get the error "Trying to get property 'x' of non-object"
For all the objects in the timeline?
Well, you did not answer my question whether all the events do this or just a fraction of them. Some events have no information about the position of their occurrence because it might be irrelevant to them.
$summoner = $api->getSummonerByName("iamthekronny");
$match = $api->getMatchlistByAccount($summoner->accountId);
$time = $api->getMatchTimeline($match->matches[0]->gameId);
foreach ($time as $timelineFrames)
{
foreach ($timelineFrames->participantFrames as $frame)
{
if ($frame->participantId == "7")
{
if (!is_null($frame->position))
echo "Event at [{$frame->position->x}, {$frame->position->y}]\n";
else
echo "Event at unknown\n";
}
}
}
Event at [12006, 11496]
Event at [6970, 6324]
Event at [7005, 6537]
Event at [7742, 6948]
Event at [6657, 6299]
Event at [5671, 5123]
Event at [7094, 6375]
Event at [6930, 6486]
Event at [3922, 4011]
Event at [5032, 4778]
Event at [7622, 6935]
Event at [11392, 10935]
Event at [5800, 6412]
Event at [7815, 7052]
Event at [2311, 1005]
Event at [5929, 6440]
Event at [2351, 3120]
Event at [7226, 7666]
Event at [2149, 3221]
Event at [8274, 7990]
Event at [3519, 2230]
Event at unknown
Please make sure you invest some time into properly researching and debugging your program before writing here. This is not supposed to be a forum, where I help you develop your algorithm - do not get me wrong - I care. I am so happy that someone is using the library and is trying to create something amazing, but I do not have the time to spare to help everyone with programming basics.
Please do not get discouraged by my comments and if you get absolutely lost with no one else to help you, please message me here, but do not make a habit of me fixing your program 👅.
thanks for you help again ! , and i understand you , you already helped me a lot and i learned a lot aswell .