I want to tryout some scripting on my MiSTer.
When a game is launched to get the core, name and path and doing a HTTP get for example with these variables.
What is the most robust way to achieve that?
Having a sample script how to do it or some references would be great
How to retrieve the current core and name launched in a script?
How to retrieve the current core and name launched in a script?
- ItalianGrandma
- Posts: 211
- Joined: Sun May 24, 2020 7:09 pm
- Has thanked: 45 times
- Been thanked: 52 times
- Contact:
Re: How to retrieve the current core and name launched in a script?
I think I heard that there may be better ways to retrieve this info now, but this script might be helpful: https://github.com/christopher-roelofs/ ... b/releases
- lagerfeldt
- Posts: 170
- Joined: Mon Jan 03, 2022 8:32 pm
- Location: Denmark
- Has thanked: 33 times
- Been thanked: 85 times
- Contact:
Re: How to retrieve the current core and name launched in a script?
I've done that to make my high score website scroll to the game/core currently being played:
https://holgercade.zorkweb.dk/?mode=live
Something like that?
Patron of MiSTer + theypsilon + Jotego Team + Coin-Op Collection + Pierco + Nullobject
- aberu
- Core Developer
- Posts: 1192
- Joined: Tue Jun 09, 2020 8:34 pm
- Location: Longmont, CO
- Has thanked: 247 times
- Been thanked: 411 times
- Contact:
Re: How to retrieve the current core and name launched in a script?
delarou wrote: ↑Mon Sep 18, 2023 2:37 pmI want to tryout some scripting on my MiSTer.
When a game is launched to get the core, name and path and doing a HTTP get for example with these variables.
What is the most robust way to achieve that?
Having a sample script how to do it or some references would be great
https://github.com/wizzomafizzo/mrext
Wizzo has a lot of this happening in the Remote script. Check it out.
The core name is in a tmp or temp folder and he references it there in one of the Go files.
Re: How to retrieve the current core and name launched in a script?
lagerfeldt wrote: ↑Wed Sep 20, 2023 5:34 amI've done that to make my high score website scroll to the game/core currently being played:
https://holgercade.zorkweb.dk/?mode=live
Something like that?
Yes, as long you get always the currently game/core being played
You have some sample script, guidance, github, ...?
Re: How to retrieve the current core and name launched in a script?
ItalianGrandma wrote: ↑Wed Sep 20, 2023 2:15 amI think I heard that there may be better ways to retrieve this info now, but this script might be helpful: https://github.com/christopher-roelofs/ ... b/releases
Thank you for your response, I will have a look
Re: How to retrieve the current core and name launched in a script?
aberu wrote: ↑Wed Sep 20, 2023 1:12 pmdelarou wrote: ↑Mon Sep 18, 2023 2:37 pmI want to tryout some scripting on my MiSTer.
When a game is launched to get the core, name and path and doing a HTTP get for example with these variables.
What is the most robust way to achieve that?
Having a sample script how to do it or some references would be greathttps://github.com/wizzomafizzo/mrext
Wizzo has a lot of this happening in the Remote script. Check it out.
The core name is in a tmp or temp folder and he references it there in one of the Go files.
Great, I will have a look at the code.
Thank you
- lagerfeldt
- Posts: 170
- Joined: Mon Jan 03, 2022 8:32 pm
- Location: Denmark
- Has thanked: 33 times
- Been thanked: 85 times
- Contact:
Re: How to retrieve the current core and name launched in a script?
delarou wrote: ↑Wed Sep 20, 2023 5:06 pmlagerfeldt wrote: ↑Wed Sep 20, 2023 5:34 amI've done that to make my high score website scroll to the game/core currently being played:
https://holgercade.zorkweb.dk/?mode=live
Something like that?
Yes, as long you get always the currently game/core being played
You have some sample script, guidance, github, ...?
Yes, you get the current core/arcade game.
Go to my website and you'll see it in effect (check the URL as well). It updates every 5 seconds, so wait a few seconds.
This is the "live" mode on my website (the green play button). The yellow star button will engage the normal (non-live) mode.
We made this script and named it zorkweb_update.sh, placed it in media/fat/Scripts on the MiSTer:
Code: Select all
#!/bin/bash
while [[ 1 ]]; do
curl -s -o /dev/null -k -X GET "https://holgercade.zorkweb.dk/currentcore.php?core=`cat /tmp/CORENAME`";
sleep 5;
done
Then added the following to the existing user-startup.sh in media/fat/Linux on the MiSTer:
Code: Select all
# Zorkweb Holgercade High Score Curl
echo "***" $1 "***"
screen -dmS zorkweb /media/fat/Scripts/zorkweb_update.sh
On the server side we've made the file currentcore.php that does this:
Code: Select all
<?php
// currentcore input script
// debugging
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// Setup and mode handling
if (isset($_GET['core'])) {
$currentcore = $_GET['core'];
print $currentcore;
file_put_contents('./currentcore.txt', $currentcore);
}
?>
currentcore.txt then contains e.g. "blktiger" curled from the MiSTer.
Patron of MiSTer + theypsilon + Jotego Team + Coin-Op Collection + Pierco + Nullobject
Re: How to retrieve the current core and name launched in a script?
lagerfeldt wrote: ↑Fri Sep 22, 2023 4:42 pmdelarou wrote: ↑Wed Sep 20, 2023 5:06 pmlagerfeldt wrote: ↑Wed Sep 20, 2023 5:34 amI've done that to make my high score website scroll to the game/core currently being played:
https://holgercade.zorkweb.dk/?mode=live
Something like that?
Yes, as long you get always the currently game/core being played
You have some sample script, guidance, github, ...?Yes, you get the current core/arcade game.
Go to my website and you'll see it in effect (check the URL as well). It updates every 5 seconds, so wait a few seconds.
This is the "live" mode on my website (the green play button). The yellow star button will engage the normal (non-live) mode.
We made this script and named it zorkweb_update.sh, placed it in media/fat/Scripts on the MiSTer:
Code: Select all
#!/bin/bash while [[ 1 ]]; do curl -s -o /dev/null -k -X GET "https://holgercade.zorkweb.dk/currentcore.php?core=`cat /tmp/CORENAME`"; sleep 5; done
Then added the following to the existing user-startup.sh in media/fat/Linux on the MiSTer:
Code: Select all
# Zorkweb Holgercade High Score Curl echo "***" $1 "***" screen -dmS zorkweb /media/fat/Scripts/zorkweb_update.sh
On the server side we've made the file currentcore.php that does this:
Code: Select all
<?php // currentcore input script // debugging ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Setup and mode handling if (isset($_GET['core'])) { $currentcore = $_GET['core']; print $currentcore; file_put_contents('./currentcore.txt', $currentcore); } ?>
currentcore.txt then contains e.g. "blktiger" curled from the MiSTer.
Thank you very much
I will take a look at it