I make generators on Perchance.org and do a bunch of other cool things.
Links:
While the event is starting, I want to mention some more thoughts I’ve been keeping earlier after hosting the event midnight, about some planned updates for the Events page in the future (and probably going to implement them in the next Preview updates right away):
(Will write down more once they start to pour in)
You can prevent the output from accidentally evaluating the selectOne
of empty n
arrays by just not evaluating the <span contenteditable ...
part when that empty array has no length (basically you put a condition in which if n
isn’t empty then evaluate the span word element, which eliminates that syntax error problem):
You can also check for n.length > 0
instead of n.length
. Also pretty cool generator concept! A random letter generator button might be a good idea. Here’s how would you implement this using a list and a button:
letter
["{A-Z}".selectMany(Math.floor(Math.random()*4)+1)]
<input id="acronymInput" oninput="acronym = this.value" placeholder="type an acronym :)" value="TPK" />
<button onclick="ltr = letter.evaluateItem, acronymInput.value = ltr, acronym = ltr, count = -1, update()">random letter</button>
Bonus feature: If you type “rain”, “Go rain mode”, “Let it rain”, or “Just rain” in the comments of the plugin page, it’ll activate the rain effect right on the page. Otherwise, if you comment “stop”, “Please stop the rain”, or “This plugin is so cool, I’d wish to stop the rain”, it’ll stop the rain effect.
My solution is quite simple here. You just create a list of races (in this example, list of fruits) that has a sublist of race types (in this example, fruit types),
fruit
Apple
Green Apple
Red Apple
Blue Apple
Grape
Red Grape
Green Grape
Berries
Blackberry
Blueberry
and then reference them in the output like this:
Fruit: [fr = fruit.selectOne, fr.getName]
Fruit type: [fr]
You can then change the references of fruits to races and modify them as you like.
races
Elf
High Elf
Wood Elf
Dark Elf
...
Did you put the Death_Chance
and Illness_type
variables into a parent list like this?
someListName
Death_Chance = Moral Blow
Illness type = Whitecough
If so, you’d need to change the aListName
part of the syntax to reference the name of the sublist:
<br>Death Chance: <select oninput="someListName.Death_Chance = this.value">
<option value="Moral Blow">Moral Blow</option>
...
<br>Illness type: <select oninput="someListName.Illness_type = this.value">
<option value="Whitecough">Whitecough</option>
[
]
I’ve had the exact same thing, the com
object was undefined
’d while testing out. But I think this was a bug on the behalf of the com
object handling, that it should retain the object without refreshing the comments section altogether.
<br>Death Chance: <select oninput="aListName.Death_Chance = this.value">
<option value="Moral Blow">Moral Blow</option>
<option value="Tragedy">Tragedy</option>
<option value="Destruction">Destruction</option>
<option value="Devastation">Devastation</option>
<option value="Calamaty">Calamaty</option>
<option value="Plague">Plague</option>
<option value="Eradication">Eradiction</option>
<option value="Extinction">Extinction (WARNING: DON'T) </option>
</select>
<p id="out1">[warningList]</p>
<button onclick="update(out1)">Show</button>
<br>Illness type: <select oninput="aListName.Illness_type = this.value">
<option value="Whitecough">Whitecough</option>
<option value="Carrionplace Disease">Carrionplace Disease</option>
<option value="Tainted prey">Tainted prey</option>
</select>
Here is a modified code for the dropdown menus so that they assign the values to the variables properly (since Death_Chance
and Illness_type
are apparently stored into some sort of parent list, so you can rename aListName
to the name of that list). Also, if the dropdown menu doesn’t work, try changing oninput
to onchange
.
You’ll also need to associate the variables written in dynamic odd notations in lists to reference the parent list as well (e.g., [
to ][
). ]
Okay, so first you add the quotes between these curly brackets wrapped syntaxes (and remove the quotes around the none
part) so they’ll be evaluated properly:
And then change the rarity picking mechanism (evaluateItem
first, create a matchable version, and then display the evaluated version instead of just selectOne
and then display) so it’ll be matched properly when picking a gimmick and an ability, to this:
[ra1 = rarity.evaluateItem, ra = ra1.match(/[A-Z]+/g)[0], ra1]
In the output
syntax I see some of the if
statements are not in lowercase, so you need to lowercase them in order to work:
(You can also just find-and-replace If
with if
btw, w/keyboard shortcut Ctrl+H
)
Yeah, I could see the overflow issue spreading across many generator pages, even into the plugin page itself. I think the Dev should apply the possible fix that would get applied across generator pages.
This issue did not appear on Firefox though upon checking.
You can actually set the settingsButtonStyle
’s and fullscreenButtonStyle
’s overflow
parameter to hidden
as a temporary workaround so that the scrollbars at the bottom would disappear.
commentOptions
settingsButtonStyle = overflow: hidden;
fullscreenButtonStyle = overflow: hidden;
Also did you notice a few more customization options were added to the Comments Plugin?
You can also add
settingsButtonStyle
,fullscreenButtonStyle
,submitButtonSuccessText
,hideSettingsButton
,hideFullscreenButton
.
There is, however, another possible way to clear the gallery besides duplicating, which is by overriding the generatorName
value to something else e.g. ai-text-to-image-generator-0324
.
I think so. If you want to make feature requests then you can make a post and/or make a comment with tag @perchance@lemmy.world just like what I’m about to do.
Also @perchance@lemmy.world when I click on the download page on any image it always brings me into a new tab with the image file. Is this some sort of bug?
There isn’t quite a way to unless there’s a “copy seed” button somewhere in the info overlay. @perchance@lemmy.world
Also a tip: you can also bring the info section by clicking on the title or description at the bottom of an image in the gallery.
You’re welcome. Also, it’s a good idea to reply to somebody that have helped so they’ll get noticed.
But what do you mean by “First, define a function in the list”?
What I mean is you put the setupColors()
function in the list panel on the left side and then put the last one (the <script>
one) at the bottom HTML panel.
If what you mean is changing the background color around the fields, I think there isn’t any support yet, but you still can do that, through a simple hacky solution:
description
...
width = min(750px, 100%); background: #cd3838 // this is where the ; will be inserted
negative
...
width = ; background: #cd3838
Essentially you could insert any CSS after the width
value (or just use width = ; <css>
without specifying the width as well), just omit the ;
at the end because the t2i framework will append that after the value.
Though, this way, upon testing on the regular AI image generator, it only works on the description and the negative prompt fields. But there’s another way, using some scripts. First, define a function in the list:
setupColors() =>
// some magic that make all of that work
for (let el of [...document.querySelectorAll(".input-inner")]) {
inputChild = el.querySelector(".input-wrapper *");
inputName = inputChild.dataset.name;
if (Object.keys(colors).includes(inputName)) {
el.style.backgroundColor = colors[inputName];
}
}
And then put this at the bottom of the HTML panel:
<script>
// Here you can define the colors of the fields that you can associate with the respective userInputs list names on the left
let colors = {
"artStyle": "#8b574d",
"numImages": "#014765"
// add more input names here if you want to
}
</script>[setupColors(), ""]
Thanks!! It worked pretty great so far. And I didn’t even know I could’ve used the window.generatorName
trick instead of changing the generator name straight away onto the iframe right after it loads. 😆
I’ll be working on rewiring the functions in the alpha demo later.
You can replace the square brackets inside with parentheses, otherwise it’ll just be interpreted as an array:
[r.roleBrawn + (s.subBrawnMod || 0)]