Howdy, Stranger!

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

Supported by

The problem with the inline_script

Hello,

I have created an experiment using OpenSesame and I wish to make it online. When I tried to check compatibility on OSweb to make it online. It showed that it item_form_base is not supported, item_inline_script not supported etc.

I am attaching the screenshot of it.

I also know that I have to change the inline script into JavaScript but I have no idea how to do it?

What should I do?

Thanks,

Tanya


Comments

  • Hi Tanya,

    You are right that both the form_base and inline_script items are not yet supported in osweb. To convert and inline_script item into javascript, you first have to replace these items with inline_javascript items, and convert your code from python to javascript. It is not really easy to tell you how to do this, except for that you can best follow some javascript tutorials if you are unfamiliar with the language. For an example of a fully implemented osweb experiment you could read through https://osdoc.cogsci.nl/3.3/tutorials/wcst/

    For the key characteristics of the inline_javascript itself, you can have a look at https://osdoc.cogsci.nl/3.3/manual/osweb/javascript/.

    I hope this helps you forward.

    Buy Me A Coffee

  • edited March 2021

    Hello🤠,

    I am having a similar problem with my experiment. I need to perform my experiment online using OSWeb. I tried OSWeb and it says inline_script not supported. So tried to change inline_script sections in Javascript. (Like variables etc.) This time I get the following error: "Cannot use import statement outside a module"

    I used "Import" in imports_and_defauts section at the begining of the experiment in the OpenSesame as follows:

    import random

    How can I fix this error? How am I supposed to change this in javascript? What should I do? I am not very good at JavaScript.

    Thank you so much. 😇

  • Hi,

    What should I do? I am not very good at JavaScript.

    Well, get better at Javascript ;)

    No, but seriously, we will be able to help you for some specific questions, but many of us aren't javascripts experts themselves. So, there is a lot of googling and trying things out involved.

    I guess it generally make sense to try to learn a bit of javascript: This tutorial by Sebastiaan for example is a great place to start: https://www.youtube.com/watch?v=NCTpb09jtQA

    To your specific questions:

    I used "Import" in imports_and_defauts section at the begining of the experiment in the OpenSesame as follows:

    I guess there are two problems. The first one is that every java_inline_script has a non-permanent workspace. That means that you need to define variables, functions and imports in every inlinescript separately. The second is that there is no random module in javascript. To get a random number, you would use Math.random() , for other random operations, like shuffle or sample it is a little more complicated, see for example this discussion.

    Generally, it is easier for us to help you, if you don't just paraphrase your problem, but actually post the error message, and ideally the code that led to that error (e.g. by uploading your experiment).

    Hope this helps somewhat,

    Eduard

    Buy Me A Coffee

  • Hello 🤠,

    Thank you so much for the suggestions. I will try to fix the problem using the link that you provided.

    If the problem continues, I will post the error message and the code.

    Best 🤠

  • Hello everyone,

    Is there an api for inline javascript elements?

    I'm trying to find out what elements are allowed/not allowed. It's been stated that the inline js elements do not cover as much ground as the inline python scripts. I've looked at the links sent above but haven't found a list of possible commands.

    Thank you!

  • Hi,

    yes in the recent update, the documentation was somewhat changed, so the link doesn't show the supported items anymore. If you want to know what was on that list, you can select, Opensesame version 3.2 (however this one is quite outdated).

    Generally, there is no api for javascript items, because there are currently no javascript functions defined in Opensesame. The things that you have to keep in mind from the Opensesame point of view are listed here. For the rest, you'll have to browse the forum or google to find javascript code that you can use in those inline_scripts to make things happen.

    I hope this clears things up a bit.

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games