Habbo Retro Fansite Pull data in real time.

React

Member
Sep 17, 2023
213
93
Hi guys, I hope that I am in the appropriate section, going to sound like a noob as I haven't got very good experience when it comes to backend.

I am working on a fansite for my friends retro HabHub, on the /homepage I would like it to function automatically so that it would pull and update the information in real-time.

You must be registered for see images attach


Could the "Event Schedule" area work with Discord, like pull the required information from the events channel in the Discord Server?



You must be registered for see images attach

Also, for the "HabHub News" area I have a JavaScript script that you show a different "article" automatically, every 60 seconds, however nothing happens.

<script> export default { data() { return { articles: [ "https://habhub.net/community/articles/welcome-to-habhub", "https://habhub.net/community/articles/rare-release", "https://habhub.net/community/articles/secrets-of-the-public-rooms", "https://habhub.net/community/articles/twitterx-giveaway", "https://habhub.net/community/articles/rare-release-2", "https://habhub.net/community/articles/the-habhub-way", "https://habhub.net/community/articles/the-future-of-habhub", "https://habhub.net/community/articles/supreme-structures", "https://habhub.net/community/articles/crazy-cats" ], currentArticleIndex: 0 }; }, computed: { currentArticle() { return this.articles[this.currentArticleIndex]; } }, methods: { updateArticle() { this.currentArticleIndex = (this.currentArticleIndex + 1) % this.articles.length; } }, mounted() { this.updateArticle(); setInterval(this.updateArticle, 60000); // Change article every 60 seconds } }; </script>

This is the code, however as I said, I am inexperienced & I don't want to be spoonfed anything, that won't help me. Suggestions/Ideas would be greatly appreciated, helping me to complete what I would like to do.
Don't comment if you're going to bring hate, I understand I have possibly approached this completely the wrong way, I am trying to learn.

Thanks in advance!
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Create some logs to the console after you assign CurrentArticleIndex, see what that logic is doing. Make sure the function is being called on the interval correctly.
 

React

Member
Sep 17, 2023
213
93
Create some logs to the console after you assign CurrentArticleIndex, see what that logic is doing. Make sure the function is being called on the interval correctly.
Could you explain a little more in-depth? I am unsure if you mean set currentArticleIndex: 0 from "0" to "1" ? would this then tell me anything in console?
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
434
647
Hey, he's saying to parse some data in the console.log function inside JavaScript within your code, to see what results your getting. This will hopefully help you identify where and what it's going wrong.
 

React

Member
Sep 17, 2023
213
93
Hey, he's saying to parse some data in the console.log function inside JavaScript within your code, to see what results your getting. This will hopefully help you identify where and what it's going wrong.
You must be registered for see images attach


i see this within console.
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
You're selected on 'Errors', so if you're using console.log() in the javascript code you won't see it unless you toggle to logs.
 

Laravel

Member
Nov 29, 2020
49
61
@React

HTML:
<script setup>
    import { ref, computed, onMounted } from 'vue'
    const article = ref()
    const articles = computed(() => [
        "https://habhub.net/community/articles/welcome-to-habhub",
        "https://habhub.net/community/articles/rare-release",
        "https://habhub.net/community/articles/secrets-of-the-public-rooms",
        "https://habhub.net/community/articles/twitterx-giveaway",
        "https://habhub.net/community/articles/rare-release-2",
        "https://habhub.net/community/articles/the-habhub-way",
        "https://habhub.net/community/articles/the-future-of-habhub",
        "https://habhub.net/community/articles/supreme-structures",
        "https://habhub.net/community/articles/crazy-cats"
    ])
    onMounted(() => {
        setArticle()
        setInterval(setArticle, 60000)
    })
    function setArticle() {
        article.value = articles.value[Math.floor(Math.random() * articles.value.length)]
    }
</script>
 

React

Member
Sep 17, 2023
213
93
@React

HTML:
<script setup>
    import { ref, computed, onMounted } from 'vue'
    const article = ref()
    const articles = computed(() => [
        "https://habhub.net/community/articles/welcome-to-habhub",
        "https://habhub.net/community/articles/rare-release",
        "https://habhub.net/community/articles/secrets-of-the-public-rooms",
        "https://habhub.net/community/articles/twitterx-giveaway",
        "https://habhub.net/community/articles/rare-release-2",
        "https://habhub.net/community/articles/the-habhub-way",
        "https://habhub.net/community/articles/the-future-of-habhub",
        "https://habhub.net/community/articles/supreme-structures",
        "https://habhub.net/community/articles/crazy-cats"
    ])
    onMounted(() => {
        setArticle()
        setInterval(setArticle, 60000)
    })
    function setArticle() {
        article.value = articles.value[Math.floor(Math.random() * articles.value.length)]
    }
</script>
Legend man, thanks!
Post automatically merged:

Latest updates on this thread.
 
Last edited:

Users who are viewing this thread

Top