Random Number Generator?

RaseCidraen
RaseCidraen
edited August 2010 in Campaign Portal Building
Hey - I was wondering if there was any Javascript compatibility with Obsidian Portal? I know that there is a device by which random die rolls can be made, and I think that runs with javascript, but I was wondering if there was a way to call a random number, possibly based on the clock time? If that's the case, and we can use Javascript, I can help generate if/else statements for people who want elements to display randomly on their webpage (For example, if you want a different statement to display every time the page is refreshed? - I'm looking at you, Duskreign :) ) A simple switch statement could work if you wanted it to just work on the day of the week. If we can't use javascript, does anyone know a way to do it via HTML, with the tools that are available?

Comments

  • RaseCidraen
    RaseCidraen
    Posts: 890
    ...Alternately, CSS might be able to handle it...
  • Duskreign
    Duskreign
    Posts: 1,085
    About five hours ago, I got this intense pain in the pit of my stomach, and I knew that, somewhere, out there, across the vast reaches of the Intertubes, someone was "looking at me."

    But yes. I need this. Please. :)
  • RaseCidraen
    RaseCidraen
    Posts: 890
    So I'm not sure about the javascript, but it doesn't look like it can be done through HTML... and I don't think the kinds of CSS that are available allow it - I wish I knew what kind of CSS commands were available - or if there was some sort of workaround. I just need a way to store a variable after one has been generated!
  • Duskreign
    Duskreign
    Posts: 1,085
    As it stands, I am just going to have to set a reminder and manually change my variable data (the Character Spotlight and Remember That Time segments... though more were planned) every couple weeks or so. It would be great if I could use the old Cream of the Crop script from the OP front page (I think it's called Favorite Campaigns now) on my page. I would even like to use it to plug some of my favorite campaigns, like yours and Arsheesh's and Garaan's, and JimTriche's, and run-on-sentence's.

    We should have an APPROVED HTML AND CSS FOR OBSIDIAN PORTAL CAMPAIGN WIKI USE page, so we know what our limitations are.
  • RaseCidraen
    RaseCidraen
    Posts: 890
    I concur! ...although, that gives me an idea..

    Rats, okay, so half the code on the front page we can't use :( I wonder if there's a third party way around it... if you were capable of writing a script that randomly changes something somewhere else (via PHP or what have you), and have OP pull the source from that link? Hmm...
  • ChainsawXIV
    ChainsawXIV
    Posts: 530
    There's no way to bring in text from outside sources as far as I know, nor are user scripts allowed outside the tightly controlled confines of the dynamic character sheet system. Both of these limitations are almost certainly based on (entirely valid) security concerns. Other people's malicious scripts and outside content could easily give Obsidian Portal a bad name. It _would_ be possible to fake this with images - create a server script on your own web space that serves up a different image every time http://yourspace.com/random.jpg is fetched, for example, and then simply put the proper image tag in your wiki - but that would be both cumbersome, inflexible, and hacky.
  • RaseCidraen
    RaseCidraen
    Posts: 890
    Yeah - I wasn't trying to circumvent the security concerns, but my thoughts were headed towards the cumbersome scripting on a separate server, to affect the same kind of functionality. Unfortunately, I'm not a code guru, and I couldn't figure out a simplified way to make it work.
  • RaseCidraen
    RaseCidraen
    Posts: 890
    Ick - php makes it possible, but I can't see a simple solution for fetching a random JPG.
Sign In or Register to comment.

April 2024
Season of Strife

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions