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 Sept 16, 2015 21:02:24 GMT -8
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Sept 18, 2015 17:58:50 GMT -8
You cannot copy paste the example because the bottom says do not reproduce without permission. But you can use the general structure because its a tutorial. Just not fruits. That would need authors permission
|
|
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 Sept 18, 2015 21:43:08 GMT -8
That's what I'm after xD - how would I do it if the weighting was in one field in an autoform and the names were in another field in the autoform?
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Sept 20, 2015 16:05:28 GMT -8
That's what I'm after xD - how would I do it if the weighting was in one field in an autoform and the names were in another field in the autoform? Just make one autoform with two fields or more if u need one for description or something. One would be called name and the other would be weight. Then you would insert the autoform variable in the code and add on [0].name 0 being the index of the first item in your autoform Autoformvariable[0].name would output the nam Autoformvariable[0].weight would be the weight Put it in a for loop and you got them all
|
|
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 Sept 20, 2015 19:39:33 GMT -8
Thank you so much! Another question - I'm trying to make this all appear on a new page but so far no Buenos any help?
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Sept 24, 2015 20:22:43 GMT -8
Thank you so much! Another question - I'm trying to make this all appear on a new page but so far no Buenos any help? U mean like ur own custom page or a new profile tab. Really u can make a page in settings or use a page remove the content and add ur own. This makes it look like a new page but it is actually just a modification
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Sept 24, 2015 20:25:09 GMT -8
If its a new page just have a jquery document ready search for a div name and add the data. Otherwise u can add the html data directly into the custom page in the admin section
|
|
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 Sept 24, 2015 23:34:16 GMT -8
Thank you so much! Another question - I'm trying to make this all appear on a new page but so far no Buenos any help? U mean like ur own custom page or a new profile tab. Really u can make a page in settings or use a page remove the content and add ur own. This makes it look like a new page but it is actually just a modification I'm trying to do it via yootil.api but as I say I'm having no luck - I might have to do a new custom page @_@ Right now the code itself is erroring as well proboards.combined_279.js:34889 An error occurred during a document.ready call: TypeError: Cannot read property '0' of undefined While executing: () {
var eandw = pb.plugin.get('equestriad_random_event_genera').settings; var events= eandw.name[0] var eweight= eandw.weight[0] //weight of each element above var totalweight=eval(ewei…(anonymous function) @ proboards.combined_279.js:34889
and I'm not sure where I went wrong $( document ).ready(function() {
var eandw = pb.plugin.get('equestriad_random_event_genera').settings;
var events= eandw.name[0]
var eweight= eandw.weight[0] //weight of each element above
var totalweight=eval(eweight.join("+")) //get total weight (in this case, 10)
var eweightevent=new Array() //new array to hold "weighted" fruits
var curevent=0
while (curevent<events.length){ //step through each fruit[] element
for (i=0; i<eweight[curevent]; i++)
eweightevent[eweightevent.length]=events[curevent]
curevent++
}
var randomnumber=Math.floor(Math.random()*totalweight)
document.write(eweightevent[randomnumber])
});
(I've took out my attempts at yootil as they're obviously going "nope" right now @_@
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Sept 24, 2015 23:48:09 GMT -8
U mean like ur own custom page or a new profile tab. Really u can make a page in settings or use a page remove the content and add ur own. This makes it look like a new page but it is actually just a modification I'm trying to do it via yootil.api but as I say I'm having no luck - I might have to do a new custom page @_@ Right now the code itself is erroring as well proboards.combined_279.js:34889 An error occurred during a document.ready call: TypeError: Cannot read property '0' of undefined While executing: () {
var eandw = pb.plugin.get('equestriad_random_event_genera').settings; var events= eandw.name[0] var eweight= eandw.weight[0] //weight of each element above var totalweight=eval(ewei…(anonymous function) @ proboards.combined_279.js:34889
and I'm not sure where I went wrong $( document ).ready(function() {
var eandw = pb.plugin.get('equestriad_random_event_genera').settings;
var events= eandw.name[0]
var eweight= eandw.weight[0] //weight of each element above
var totalweight=eval(eweight.join("+")) //get total weight (in this case, 10)
var eweightevent=new Array() //new array to hold "weighted" fruits
var curevent=0
while (curevent<events.length){ //step through each fruit[] element
for (i=0; i<eweight[curevent]; i++)
eweightevent[eweightevent.length]=events[curevent]
curevent++
}
var randomnumber=Math.floor(Math.random()*totalweight)
document.write(eweightevent[randomnumber])
});
(I've took out my attempts at yootil as they're obviously going "nope" right now @_@ have you checked if your elements have data? I think you are close but not quite var eandw = pb.plugin.get('equestriad_random_event_genera').settings.AUTOFORMNAME//add the autoform name
var events= eandw[0].name //first event name as text That's how you get a specific index of a name. However you already have it as an array with names and weights. If that's not enough help then I'll try and help you further
|
|
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 Sept 24, 2015 23:49:30 GMT -8
I put data in - I'll export the plugin if that fix doesn't work xD I was sure I'd do something derpy xD (I started coding at 3.30 am in a fit of can't sleepies!) edit: still going nope - exporting plugin (I'll need some slow steady hand holding help to set a key as I don't want people to refresh to get more favourable options in the case of not getting what they want). Throwing same error Equestriad Random Event Generator.pbp (803 B)
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Sept 29, 2015 15:42:04 GMT -8
I put data in - I'll export the plugin if that fix doesn't work xD I was sure I'd do something derpy xD (I started coding at 3.30 am in a fit of can't sleepies!) edit: still going nope - exporting plugin (I'll need some slow steady hand holding help to set a key as I don't want people to refresh to get more favourable options in the case of not getting what they want). Throwing same error View Attachment im sorry bro I've been sick. I'll try to help when i can think straight
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Sept 29, 2015 16:04:26 GMT -8
I put data in - I'll export the plugin if that fix doesn't work xD I was sure I'd do something derpy xD (I started coding at 3.30 am in a fit of can't sleepies!) edit: still going nope - exporting plugin (I'll need some slow steady hand holding help to set a key as I don't want people to refresh to get more favourable options in the case of not getting what they want). Throwing same error $( document ).ready(function() {
var eandw = pb.plugin.get('equestriad_random_event_genera').settings.events_and_weighting; var events= new Array() for(a=0;a<eandw.length;a++) {events[a] = eandw[a].name //puts event names in an array } var eweight= eandw[0].weight //weight of ONLY the first element var totalweight = 0 //get total weight (in this case, 10) var eweightevent=new Array() //new array to hold "weighted" fruits var curevent=0 for(a=0;a<eandw.length;a++) {totalweight += parseFloat(eandw[a].weight)//adds all weights } while (curevent<events.length){ //step through each fruit[] element for (i=0; i<eweight[curevent]; i++) eweightevent[eweightevent.length]=events[curevent] curevent++ } var randomnumber=Math.floor(Math.random()*totalweight) console.log(eweightevent[randomnumber])//writes to console //never call document.write after page load or it replaces all page data very bad practice });
Not exactly sure what you are trying to accomplish as I said my brain is toast. But that at least removes the error and gets what you wanted working working I think. assuming weight is a number as you see with my for loop I can add all of the weights into one variable using the += which does an increment. it's the same as saying oldweight=oldweight+newweight
|
|
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 Sept 29, 2015 22:05:44 GMT -8
Ah! Now I have a few more things to solve (( namely getting it on a new page and making it so people can only re roll 3 times total ))
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Oct 2, 2015 14:18:52 GMT -8
Ah! Now I have a few more things to solve (( namely getting it on a new page and making it so people can only re roll 3 times total )) Easy stuff. U figure it out yet?
|
|
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 Oct 2, 2015 19:13:51 GMT -8
XD the second part is a nope the first part is an argument in progress
|
|