inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Aug 12, 2013 4:46:44 GMT -8
its doing that because suvRandom isnt a url to an image
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Aug 12, 2013 4:48:02 GMT -8
Right so how would I get the url to the image -sorry really slow at this-
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Aug 12, 2013 4:51:05 GMT -8
WormopolisThanks, I appreciate the explanation. Interesting way to go about it with the cosine, I probably wouldn't have even thought about using that.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Aug 12, 2013 5:07:09 GMT -8
Right so how would I get the url to the image -sorry really slow at this- look above for what I wrote about getting the URL from the array. I can either type this all out for you or help you learn, and I have a feeling you really want to learn this stuff. WormopolisThanks, I appreciate the explanation. Interesting way to go about it with the cosine, I probably wouldn't have even thought about using that. I should probably throw something in there to ensure it never gets too close to 0.. but no one has complained about its pseudo-randomness so far...
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Aug 12, 2013 5:11:06 GMT -8
Which post exactly as there was two points autoform is already an array when you use it as a variable in the javascript. each field in the autoform becomes a property of the auto form so if your autoform was called survival_images
and in the autoform you had a field titleand urlthen in the javascript you would access a specific entry in the autoform with plugin.settings...all your plugin name stuff...survival_images[N].title or plugin.settings...all your plugin name stuff...survival_images[N].url where N is the number returned by the random result. or Oh! I need to add ; to the end of javascript lines that aren't commented don't I? and this is what I have so far //Variable that contains the images here from autoform var suvImg=proboards.plugin.get('survival_images').settings.image_testing; //math.random randomizes images and will be used here var suvRandom=Math.floor((Math.random()*suvImg.length)); //Append image to div $('div#survivalImg').append($('<img src=" output here " />')); Does this all look okay and how would I then put the output as an image? Would it be just calling the suvRandom or? suvRandom becomes the integer you use to access the specific suvImage array element and in that append, you have to break out of the single quotes if you want to use variables. you cant use variables inside '<img src="' + javascript stuff + '">' Or would it be something like this $('div#survivalImg').append($('<img src="'+ proboards.plugin.get('survival_images').settings.image_testing.image_url_test+'" />')); with some way to get the number from the randomisastion done earlier? -trying to work it out at least let me know if I'm warmer or cooler at least-
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Aug 12, 2013 5:13:47 GMT -8
the first one is closer. putting the insert back into the append line defeats the purpose of putting it into a variable in the first place
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Aug 12, 2013 5:20:17 GMT -8
okay so I would still need to use the suvRand variable
-right- so the suvRand variable gives the random number but its not linked to an image url that's the current problem I'm trying to solve right? -just checking I'm on the right page-
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Aug 12, 2013 5:25:18 GMT -8
suvRand is just an integer. suvImg is the array
suvImg[suvRand].url is the url to the image
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Aug 12, 2013 5:29:34 GMT -8
Okay and I knew I'd seen something like that somewhere to do with random numbers before -shoots self in foot- just without the .url.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Aug 12, 2013 7:13:28 GMT -8
Okay editing to add that it's now giving an undefined url - suvRandom gives a random number output between 1 - 3 suvImg lists 4 objects to choose from, and trying to bugfix myself isn't working and I can't find the theory or anything behind to try and understand how it should be talking to each other
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Aug 14, 2013 12:46:39 GMT -8
let me see what you have so far
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Aug 14, 2013 13:14:30 GMT -8
Managed to fix it after sleeping and too much doctor pepper xD
|
|