Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2014, 09:33 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,661
Abronsyth is on a distinguished road
Default Javascript and Mysidia

I know that when I first started working with Mysidia, I was able to create some pretty entertaining games and an explore feature by incorporating Javascript into it.

I haven't been able to actually work with the script in ages now, because I haven't been able to even get it to function and allow me to login, but hoping that someday it will work for me, does anyone know how javascript compatable Mysidia is?
Reply With Quote
  #2  
Old 08-12-2014, 09:22 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,256
IntoRain is on a distinguished road
Default

It works normally with mysidia once you get the hang of it, including jquery and ajax (though ajax is a bit more awkward if you don't use the widget option, like Kyttias does). If you want to put the js code in the .php pages, use Comment() objects, they take html and javascript
__________________


asp.net stole my soul.
Reply With Quote
  #3  
Old 08-21-2014, 09:39 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,661
Abronsyth is on a distinguished road
Default

Or rather, if I am wanting to create a game of pure javascript, and I simply want it to be surrounded by the site theme so it looks like part of the content, how would I go about doing that?
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #4  
Old 08-21-2014, 02:21 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,256
IntoRain is on a distinguished road
Default

Just write the whole script inside Comment(), like

$document->add(new Comment("<script>your javascript here</script>")); (if you are on 1.3.4, do this on the view file and not in the controller file)
__________________


asp.net stole my soul.
Reply With Quote
  #5  
Old 09-06-2014, 05:38 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 111,661
Abronsyth is on a distinguished road
Default

I must be doing something pretty wrong here XD Used to be so simple *sigh*

Can't get this to work;
PHP Code:
<?php

class BlankController extends AppController{

    private 
$view;
    private 
$subController;

    public function 
__construct(){
        
parent::__construct();    
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
    }
    
$document->add(new Comment("<script language="JavaScript">
// ==============================================
// Copyright 2004 by CodeLifter.com
// Free for all; but please leave in this header.
// ==============================================

var Quotation=new Array() // do not change this!

// Set up the quotations to be shown, below.
// To add more quotations, continue with the
// pattern, adding to the array.  Remember
// to increment the Quotation[x] index!

Quotation[0] = "
Quote 1";

// ======================================
// Do not change anything below this line
// ======================================
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();</script>"
));
}
?>
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #6  
Old 09-06-2014, 07:22 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,256
IntoRain is on a distinguished road
Default

See the change of color? The " is closing the comment here:

$document->add(new Comment("<script language=" <-- this closed it

Inside comments, try to use '' instead of quotation marks, try this:

PHP Code:
$document->add(new Comment("<script language='JavaScript'>
// ==============================================
// Copyright 2004 by CodeLifter.com
// Free for all; but please leave in this header.
// ==============================================

var Quotation=new Array() // do not change this!

// Set up the quotations to be shown, below.
// To add more quotations, continue with the
// pattern, adding to the array.  Remember
// to increment the Quotation[x] index!

Quotation[0] = 'Quote 1';

// ======================================
// Do not change anything below this line
// ======================================
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();</script>"
)); 
Also, I'm not sure if document.write will write the sentence in the right place. If it doesn't, you will have to add an element with Comment() (like $document->add(new Comment("<p class='quote'></p>")) or something) and then in the javascript fill the element with what you want
__________________


asp.net stole my soul.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript included in PHP? Aasixx Questions and Supports 2 10-30-2012 02:46 AM
Javascript question SilverDragonTears Questions and Supports 9 03-29-2012 09:26 PM
\\Javascript Help, Please// Poppy Questions and Supports 0 11-06-2011 11:28 AM
Javascript help? AlexC Programming and Game Development 0 07-19-2011 06:22 AM
Anyone here knows Javascript? Hall of Famer Other Chat 5 04-06-2011 07:21 PM


All times are GMT -5. The time now is 07:46 AM.

Currently Active Users: 452 (0 members and 452 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636