Not too savvy with macros in notepad++, but essentially I want to take this input:
"BAILIFF": [
"The prisoners will all stand.",
"All present, stand and make respectful attention to honouredJudge.",
"Before this gracious court now appear these prisoners toanswer for the multiple and grievous savageries of their species. Howplead you, criminal?",
"Criminals keep silence!",
"You will answer the charges, criminals.",
"Criminal, you will read the charges to the court.",
"All present, respectfully stand. Q",
"This honourable court is adjourned. Stand respectfully. Q"
],
"MCCOY": [
"Hold it right there, boy.",
"What about my age?",
"Troubles me? What's so damned troubling about not having died? How old do you think I am?",
"Explain how you remember that so exactly.",
"I don't see any points on your ears, boy, but you sound like aVulcan.",
"Almost as bad.",
"They are, they are. And damned annoying at times.",
"Well, this is a new ship, but she's got the right name. Now youremember that, you hear.",
"You treat her like a lady, and she'll always bring you home."
],
and transition it to:
"The prisoners will all stand." "BAILIFF"
"All present, stand and make respectful attention to honouredJudge." "BAILIFF"
"Before this gracious court now appear these prisoners toanswer for the multiple and grievous savageries of their species. Howplead you, criminal?" "BAILIFF"
"Criminals keep silence!" "BAILIFF"
"You will answer the charges, criminals." "BAILIFF"
"Criminal, you will read the charges to the court." "BAILIFF"
"All present, respectfully stand. Q" "BAILIFF"
"This honourable court is adjourned. Stand respectfully. Q" "BAILIFF"
"Hold it right there, boy." "MCCOY"
"What about my age?" "MCCOY"
"Troubles me? What's so damned troubling about not having died? How old do you think I am?" "MCCOY"
"Explain how you remember that so exactly." "MCCOY"
"I don't see any points on your ears, boy, but you sound like aVulcan." "MCCOY"
"Almost as bad." "MCCOY"
"They are, they are. And damned annoying at times "MCCOY"
"Well, this is a new ship, but she's got the right name. Now youremember that, you hear." "MCCOY"
"You treat her like a lady, and she'll always bring you home." "MCCOY"
Any help is appreciated. Thanks.
Try with this macro:
Record macro
Control + H (search and replace)
Search what: ^("[^"]+")\s*:\s*\[\s*("[^\n]*?")\s*,(?=\R)|^("[^\n]*?") ("[^"]+")\R\K\h+("[^\n]*?)(?:,(?=\R)|\s*\],?)
Replace by: (?2\2 \1)(?3\5 \4)
Replace all
Next >
Replace all
Stop recording macro.
Now play the macro with the option: Run macro multiple times and Run until the end of file
Related
I'm currently having a small problem with getting containers to work properly in inform7. I've created a bed, which is marked as an enterable container. When the scene begins, the player is started out in the bed, and that appears to work ok. You can leave the container just fine. BUT, you can't re-enter the container. If I try to enter/get in/go inside the bed I get a message saying "you can't go that way" and I don't understand why. I'm quite new so there's probably something super simple that I'm missing here. Any ideas? Thanks so much!
Here's my code:
A Warm Cabin is a room. "A one room cabin with a fireplace on the south wall. There's a single window, frosted over from the cold."
Coming to is a scene. Coming to begins when Unconscious ends.
When coming to begins:
move the player to the double bed;
try waking up;
continue the action.
The Double Bed is a container. The double bed is in a warm cabin. The double bed is enterable and fixed in place. The description of the double bed is "A double bed strewn with soft, botanically-embroidered quilts and over-fluffed pillows. . . It's quite cozy."
Instead of entering the double bed: try going inside.
I am setting up JSON+LD tags on my product pages for Facebooks "Dynamic Ads & Commerce".
https://developers.facebook.com/docs/marketing-api/catalog/reference/
Two tags it states are required:
id
Required for dynamic ads and commerce.
availability
Required for dynamic ads and commerce.
I've added these, but it causes Google to reject my json+ld markup.
Invalid enum value in field 'availability'
1.
2.
How could I please both parties here? If I am adding json+ld markup, it may as well have all required elements to be valid on Google and Facebook (Catalog).
[
{
"#context":"http:\/\/www.schema.org",
"#type":"Product",
"name":"Silentnight Safe Nights Toddler Bedset – 4.5 Tog",
"title":"Silentnight Safe Nights Toddler Bedset – 4.5 Tog",
"url":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"link":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"image":"http:\/\/myexampledomain.co.uk\/app\/uploads\/sites\/3\/2019\/10\/silentnight-safe-nights-toddler-bedset-4.5-tog-pack.jpg",
"image_link":"http:\/\/myexampledomain.co.uk\/app\/uploads\/sites\/3\/2019\/10\/silentnight-safe-nights-toddler-bedset-4.5-tog-pack.jpg",
"description":"The Silentnight Toddler Duvet and Pillow set makes a great first bed set for your little one. The cot bed sized set includes a snuggly duvet and a soft pillow that is specially designed for children. The slim profile of the pillow offers your child just the right amount of support they need. It's important that small children don't overheat in bed, so the light and soft duvet comes in a 4.5 tog weight rating. Both the pillow and duvet are made from a smooth polycotton cover offering breathable comfort. The products are filled with anti-allergy hollowfibre that actively defends against the bacteria and dust mites that can cause allergies providing a cleaner, fresher and altogether a safer option for a good night's sleep. Our anti-allergy fibres are approved by the British Allergy Foundation, which means they have the ultimate seal of approval. Our fibres have been scientifically tested and are proven to reduce or remove allergens from the indoor environment.\nSuitable only for children over 12 months. Both the pillow and duvet are fully machine washable, and thanks to the easy care polycotton covers, the products have great recovery and can be washed time and time again.",
"sku":"506984LS",
"id":17214,
"productID":17214,
"offers":[
{
"#type":"Offer",
"price":"30.99",
"priceCurrency":"GBP",
"url":"http:\/\/myexampledomain.co.uk\/product\/silentnight-safe-nights-toddler-bedset-4-5-tog\/",
"gtin":"5012701506984",
"gtin8":"5012701506984",
"condition":"new",
"availability":"in stock",
"inventoryLevel":54
}
],
"brand":"Silentnight"
}
]
In my project I have, each of the card values displayed on the screen they are looped over from JSON using ngFor. The desired goal is when a user clicks on a card it displays just the information about that card from the JSON while just showing the content in my div with an *ngIf. I have an animation created to fade in a mask where I want the content displayed. Currently if you click on the card it just shows the array of thumbnails. I'm not getting any errors or anything to go on. I've tirelessly searched for answers on how to accomplish showing an individual key on a click. I need the Card image, name, and description displayed for a single card at a time. I feel like I've hit a road block and am not Googling the correct description. Please let me know if I need to further clarify. Thank you for any direction you can offer.
[
{
"id": 1,
"content": [
{
"sin": "Vanity",
"card": "/assets/img/vanity.jpg",
"icon": "/assets/img/vanityIcon.jpg",
"info": "In almost every list pride (or hubris or vanity) is considered the original and most serious of the seven deadly sins, and indeed the ultimate source from which the others arise. It is identified as a desire to be more important or attractive than others, failing to acknowledge the good work of others, and excessive love of self (especially holding self out of proper position toward God). Dante's definition was 'love of self perverted to hatred and contempt for one's neighbor.' In Jacob Bidermann's medieval miracle play, Cenodoxus, pride is the deadliest of all the sins and leads directly to the damnation of the titulary famed Parisian doctor. In perhaps the best-known example, the story of Lucifer, pride (his desire to compete with God) was what caused his fall from Heaven, and his resultant transformation into Satan. Vanity and narcissism are prime examples of this sin. In Dante's Divine Comedy, the penitents were forced to walk with stone slabs bearing down on their backs in order to induce feelings of humility."
}
]
},
{
"id": 2,
"content": [
{
"sin": "Envy",
"card": "/assets/img/envy.jpg",
"icon": "/assets/img/envyIcon.jpg",
"info": "Like greed, envy may be characterized by an insatiable desire; they differ, however, for two main reasons. First, greed is largely associated with material goods, whereas envy may apply more generally. Second, those who commit the sin of envy resent that another person has something they perceive themselves as lacking, and wish the other person to be deprived of it. Dante defined this as 'love of one's own good perverted to a desire to deprive other men of theirs.' In Dante's Purgatory, the punishment for the envious is to have their eyes sewn shut with wire because they have gained sinful pleasure from seeing others brought low. Aquinas described envy as 'sorrow for another's good'."
}
]
},
{
"id": 3,
"content": [
{
"sin": "Sloth",
"card": "/assets/img/sloth.jpg",
"icon": "/assets/img/slothIcon.jpg",
"info": "More than other sins, the definition of sloth has changed considerably since its original inclusion among the seven deadly sins. In fact it was first called the sin of sadness or despair. It had been in the early years of Christianity characterized by what modern writers would now describe as melancholy: apathy, depression, and joylessness — the last being viewed as being a refusal to enjoy the goodness of God and the world God created. Originally, its place was fulfilled by two other aspects, acedia and sadness. The former described a spiritual apathy that affected the faithful by discouraging them from their religious work. Sadness (tristitia in Latin) described a feeling of dissatisfaction or discontent, which caused unhappiness with one's current situation. When Thomas Aquinas selected acedia for his list, he described it as an 'uneasiness of the mind', being a progenitor for lesser sins such as restlessness and instability. Dante refined this definition further, describing sloth as being the 'failure to love God with all one's heart, all one's mind and all one's soul.' He also described it as the middle sin, and as such was the only sin characterised by an absence or insufficiency of love. In his 'Purgatorio', the slothful penitents were made to run continuously at top speed."
}
]
},
{
"id": 4,
"content": [
{
"sin": "Wrath",
"card": "/assets/img/wrath.jpg",
"icon": "/assets/img/wrathIcon.jpg",
"info": "Wrath (or anger or 'Rage') may be described as inordinate and uncontrolled feelings of hatred and anger. These feelings can manifest as vehement denial of the truth, both to others and in the form of self-denial, impatience with the procedure of law, and the desire to seek revenge outside of the workings of the justice system (such as engaging in vigilantism) and generally wishing to do evil or harm to others. The transgressions borne of vengeance are among the most serious, including murder, assault, and in extreme cases, genocide. Wrath is the only sin not necessarily associated with selfishness or self-interest (although one can of course be wrathful for selfish reasons, such as jealousy, closely related to the sin of envy). Dante described vengeance as 'love of justice perverted to revenge and spite'. In its original form, the sin of wrath also encompassed anger pointed internally rather than externally. Thus suicide was deemed as the ultimate, albeit tragic, expression of wrath directed inwardly, a final rejection of God's gifts."
}
]
},
{
"id": 5,
"content": [
{
"sin": "Lust",
"card": "/assets/img/lust.jpg",
"icon": "/assets/img/lustIcon.jpg",
"info": "Lust (or lechery) is usually thought of as excessive thoughts or desires of a sexual nature. Giving in to lusts can lead to sexual or sociological compulsions and/or transgressions including (but not limited to) sexual addiction, fornication, adultery, bestiality, rape, perversion, and incest. Dante's criterion was 'excessive love of others', which therefore rendered love and devotion to God as secondary. In 'Purgatorio', the penitent walks within flames to purge himself of lustful/sexual thoughts and feelings."
}
]
},
{
"id": 6,
"content": [
{
"sin": "Gluttony",
"card": "/assets/img/gluttony.jpg",
"icon": "/assets/img/gluttonyIcon.jpg",
"info": "Derived from the Latin gluttire, meaning to gulp down or swallow, gluttony is the over-indulgence and over-consumption of anything to the point of waste. In the Christian religions, it is considered a sin because of the excessive desire for food, or its withholding from the needy. Depending on the culture, it can be seen as either a vice or a sign of status. Where food is relatively scarce, being able to eat well might be something to take pride in (although this can also result in a moral backlash when confronted with the reality of those less fortunate). Where food is routinely plentiful, it may be considered a sign of self-control to resist the temptation to over-indulge."
}
]
},
{
"id": 7,
"content": [
{
"sin": "Greed",
"card": "/assets/img/greed.jpg",
"icon": "/assets/img/greedIcon.jpg",
"info": "Greed (or avarice, covetousness) is, like lust and gluttony, a sin of excess. However, greed (as seen by the church) is applied to the acquisition of wealth in particular. St. Thomas Aquinas wrote that greed was 'a sin against God, just as all mortal sins, in as much as man condemns things eternal for the sake of temporal things.'' In Dante's Purgatory, the penitents were bound and laid face down on the ground for having concentrated too much on earthly thoughts. 'Avarice' is more of a blanket term that can describe many other examples of greedy behavior. These include disloyalty, deliberate betrayal, or treason,[citations needed] especially for personal gain, for example through bribery . Scavenging[citation needed] and hoarding of materials or objects, theft and robbery, especially by means of violence, trickery, or manipulation of authority are all actions that may be inspired by greed. Such misdeeds can include simony, where one profits from soliciting goods within the actual confines of a church."
}
]
}
]
(Updated to include full JSON)
<!-- CARD CONTENT -->
<div class="table" *ngFor="let sins of cardwork; index as i">
<!-- CARD CONTENT -->
<div class="cardsLayedOut">
<a href="#" (click)="toggleCard(i)"> // User Clicks here
<img class="card" [ngStyle]="rotateCards()" *ngFor="let sublist of sins.content" [src]="sublist.card" />
</a>
</div>
<div class="" *ngIf="cards" #cards [#clickevent]>
<div class="mask columnCentered">
<div class="contentLayout" *ngFor="let sublist of sins[i]?.content">
<img class="largeCard" [src]="sublist[i]?.card" />
<div class="sinInfo">
<h3>{{sublist[i]?.sin}}</h3>
<p>{{sublist[i]?.info}}</p>
</div>
</div>
<app-thumnail></app-thumnail>
</div>
</div>
</div>
My toggle for hiding/showing the card information is
toggleCard() {
this.cards = true;
}
This is the current state when adding an array holder of cards = []; and in my toggleCard(i) this.cards[i] = !this.cards[i];
The second image is the desired state for each of the cards.
Your toggle function isn't right.
You are sending index i as an argument from your template (click)="toggleCard(i)" but aren't capturing it in your component.
You should capture that index i because it uniquely identifies the clicked card. If not how will you know which card is clicked?
toggleCard(var i) {
// Handle click event.
}
Also, you are just using one cards variable to toggle the state of all the cards. So if one card is clicked, all the cards are shown or hidden not just that clicked card.
You should have an array cards[] which takes boolean values and keeps track of toggle state of each card.
In your toggleCard() function, whenever a card is clicked, toggle appropriate value in this array based on the index i you are receiving.
var cards = []; // Initialize with boolean values.
// Array length would be equal to the number of your cards.
toggleCard(var i) {
this.cards[i] = !this.cards[i];
}
EDIT:
Regarding your problem after implementing suggested changes:
In your StackBlitz:
You are initializing selectedCard to false, but this variable takes number values. This shouldn't be an issue since JavaScript allows dynamic types.
There is a typo sin instead of sins in this statement <p>{{ sin.content.sin }}</p>. It should be <p>{{ sins.content.sin }}</p>.
Fix these and you should see all the cards.
I've been designing this game, and Ive come across a weird problem. Now maybe it's just something simple I've missed or some way I formatted it. When I run my code I get these errors that suggest that none of the variables I've been defining are being declared/defined. On top of that none of the functions seem to run... Should I define text1, button1Name, etc... as Global variable? or is their a better way?
##Project 1 v4
##Structure whole program with base functionality
##Begin with an outline then fill in functions and windows from V2, and V3.
import Tkinter
import random
inventory=[]
playCount=0
def startGame():
##adds name
##button that calls StoryCard
text1="Welcome to Treasure Quest!! The Game that allows you to pick your own destiny! Treasure quest is a very simple game. The story will display on the screen until it reaches an event. At each event you will be shown two choices. Each decision may cause you to leave with more treasure or to die a horrible death... Still like any true or false question on a final exam, you only have a 50/50 chance of ruining your entire life if you do not know! Now that you know how to play, please click the button below to start the game!"
button1= introCard()
button1Name="Play"
button2= win.destroy
button2Name="Quit"
def introCard():
text1="You are the bravest knight in the service of the great kingdom Universitas! The kingdom has long been an icon throughout the world, but now it faces great peril. The king of Universitas has foolishly spent the entirety of the kingdoms fortune shopping online. The only hope for the kingdom, is to find the money to pay off it's debts. Luckily recently some scrolls have been found that describe the locations of hidden treasures. You have been selected to find these treasures. Do you except?"
button1=winCard()
outcome1="You embark upon your quest!"
button1Name="Accept!"
button2=lossCard()
outcome2="The kingdom falls into debt and you die of dysentary... Nice going Oregon Trail..."
button2Name="Decline!"
def storyCard(n):##This function will randomly select a story chunk
##recieves a random int
##tests for true int w/ if then else line
##Story blurbs for these are stored in V2 copy them!
if n ==1:
text1="You come across a dark cave... A dragon is said to lurk within... You enter and see the Holy Sword... How do you take it?"
button1=lossCard()
outcome1="The dragon bakes you to a crisp... Sorry!"
button1Name="Bargain for it!"
button2=winCard()
outcome2="Victory! You sneak past the dragon and make off with the sword!"
button2Name="Steal it!"
#get="Holy Sword"
elif n==2:
text1="You come across a mummys tomb... You see two doors. Take the front entrance or the hidden entrance?"
button1=winCard()
outcome1="The mummy is awake and glad for company! He feeds you tea and sets you on your way with gifts!"
button1Name="Front"
#get="A beautiful glass vase!"
button2=lossCard()
outcome2="The mummy sees you! It screams thief! and shivs you..."
button2Name="Hidden"
elif n==3:
text1="You come across a magic tree inhabited by elves. They ask you to climb up and see their beautiful home."
button1=lossCard()
outcome1="You climb high but slip off a branch and fall to your death. The elves laugh."
button1Name="Climb"
button2=winCard()
outcome2="The elves are perplexed as to why you do not want to see them. They come down and give you a new couch to show off their things."
button2Name="Stay"
#get="A rad couch"
elif n==4:
text1="You come across a cave filled with strange lights! A troll stands guard."
button1=winCard()
outcome1="This is a hip and happening new dwarven nightclub! The troll lets you in because you seem cool! The dwarves give you some rare cave mushrooms. It seems lame but they said the kings a regular and they will go over well. You have a fun night... You drink to much ale and get a late start the next morning though..."
button1Name="Strut in!"
#get="Rare Mushrooms"
button2=winCard()
outcome2="This is actually a hip new dwarven nightclub! The bouncer troll won't let you in though... Oh well! dwarves are hipsters anyways! Gratefull for your company the troll gives you an amulet!"
button2Name="Wait in line."
#get="Sweet Amulet"
elif n==5:
text1="You come across a hut in the woods! Its owned by Merlin! The great wizard starts up conversation and invites you inside!"
button1=lossCard()
outcome1="Insulted, Merlin kills you with an axe... you would have expected magic... but no, Merlin is a psychopath and prefers to murder with axes."
button1Name="Leave"
button2=winCard()
outcome2="He talks about his GOD DAMNED GRANDKIDS FOR FOUR HOURS... He is grateful for you company however and lets you leave with his staff."
button2Name="Enter"
#get="A sweet Staff"
## each if, elif, ect must contain
##Text blurb
##Button 1 function def
##Button 2 function def
##button 1 name
##button 2 name
##Outcome 1 Text
##Outcome 2 Text
def winGame():
text1="CONGRATULATIONS!! You have collected enough treasure to pay off the kingdoms debts! You will forever be known to the people as a great knight! The king is in your debt!"
button1Name="Hooray!"
button1=win.destroy
button2Name="Huzzah!"
button2=win.destroy
def winCard():##Describes how event played out
#inventory.append[get]
playCount+=1
text1= outcome1 or outcome2
if playCount == 5:
button1Name="Onward!"
button1=winGame()
button2Name="Go Forth!"
button2=winGame()
else:
button1Name="Onward!"
button1=storyCard(random.randint(1,5))
button2Name="Go Forth!"
button2=storyCard(random.randint(1,5))
def lossCard():
text1=outcome1 or outcome2
button1Name="Game Over"
button1= win.destroy
button2Name="Game Over"
button2= win.destroy
startGame()
win=Tkinter.Tk()
win.title("TREASURE QUEST!!")
Textlabel=Tkinter.Label(win,text = text1,font=('Times New Roman',12),justify=LEFT,)
Textlabel.pack()
Row2=Tkinter.Frame(win)
Btn1=Tkinter.Button\
(Row2, text=button1Name, command=button1,font=('Times New Roman',12))
Btn2=Tkinter.Button\
(Row2, text=button2Name, command=button2, font=('Times New Roman',12))
Btn1.pack(side='left')
Btn2.pack(side='left')
Row2.pack()
win.mainloop()
When I run the code I get these errors:
Traceback (most recent call last):
File "C:/Users/Logan/Desktop/Project#1V4.py", line 141, in <module>
startGame()
File "C:/Users/Logan/Desktop/Project#1V4.py", line 17, in startGame
button1= introCard()
File "C:/Users/Logan/Desktop/Project#1V4.py", line 26, in introCard
button1=winCard()
File "C:/Users/Logan/Desktop/Project#1V4.py", line 116, in winCard
playCount+=1
UnboundLocalError: local variable 'playCount' referenced before assignment
If you want to change a global variable in a function, you need to use the keyword global as follows -
def winCard():##Describes how event played out
global playCount
#inventory.append[get]
playCount+=1
I know it isn’t the best idea to have html in your JSON but sadly I am not in control of this database or this website and am not given those privileges! I am making google maps markers and one of the values is corrupting the data and not being processed right. I know the issue is in the DESC value, is there some sort of character that isn’t escaped? Because almost all of the other objects in the JSON work just fine besides this one.
{"PHONE":"847-509-2000”,
"LAT":42.15223,
"STATE":"IL”,
"ZIP":60015.0,
"NAME":"DC Sarnies”,
"DESC":"Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant
specializing in sandwiches and classic American food with a twist. As well as a
restaurant, we serve as a research and development kitchen for its parent company,
Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try
out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies
has something for everyone with a wide variety of appetizers, soups, salads, entrees and
signature sandwiches and burgers to choose from. A full bar also gives diners a wide range
of craft beers including more than 25 on tap, wine and cocktails. For more information
visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.”,
"LONG":-87.84241,
"CITY":"Deerfield”,
"ADDR":"649 Lake Cook Road”,
"PHOTO":"DCcrabcakeburger.jpg”}]
jsonlint error message: Parse error on line 74:
...02, "DESC": "Opening in early Ma
----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
http://jsonlint.org/ use this website to validate your JSON.
The problem here are the closing quotes you use for strings, they're invalid.
End double quotes wrong. Rest everything is fine and working.
The double quotes at the end of the values are the problem. They're the wrong character.
There are a couple issues:
Different quotes used. ” is different from ".
Multi-line isn't escaped. If you need the line breaks, use \n. Otherwise, just have it one line
The extra ] at the end shouldn't be there
This is what you should have:
{
"PHONE": "847-509-2000",
"LAT": 42.15223,
"STATE": "IL",
"ZIP": 60015,
"NAME": "DC Sarnies",
"DESC": "Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant specializing in sandwiches and classic American food with a twist. As well as a restaurant, we serve as a research and development kitchen for its parent company, Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies has something for everyone with a wide variety of appetizers, soups, salads, entrees and signature sandwiches and burgers to choose from. A full bar also gives diners a wide range of craft beers including more than 25 on tap, wine and cocktails. For more information visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.",
"LONG": -87.84241,
"CITY": "Deerfield",
"ADDR": "649 Lake Cook Road",
"PHOTO": "DCcrabcakeburger.jpg"
}