KVonGit / quest-compiler

Archive only - no longer developed
MIT License
1 stars 0 forks source link

Adding a Custom Status Pane and Trying to Fix the Error - Step by Step #7

Closed KVonGit closed 2 months ago

KVonGit commented 2 months ago

Discussed in https://github.com/KVonGit/quest-compiler/discussions/6

Originally posted by **KVonGit** August 13, 2024 ## Added to game.js ```js function setCustomStatus(s) { el = $('#customStatusPane'); el.html(s); } ``` --- ![image](https://github.com/user-attachments/assets/2c30ab21-d80f-450d-b637-2138db068c36) --- ```bash $ grep "setPanes" * playercore.js:function setPanes(fore, back, secFore, secBack, highlight) { ``` --- ![image](https://github.com/user-attachments/assets/bc278d27-f730-4d5c-842e-2fe1f06d50a9) --- ## Added to game.js ```js function setPanes(fore, back, secFore, secBack, highlight) { if (arguments.length == 2) { secFore = back; secBack = fore; } if (arguments.length < 5) { highlight = 'orange' } commandColour = fore; for (i = 0; i < elements.length; i++) { setElement(elements[i], fore, back); } for (i = 0; i < dirs.length; i++) { setElement(dirs[i], fore, back); } var head = $('head'); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); head.append(''); //$('.ui-button-text').css('color', fore); //$('.ui-state-active').css('color', fore); //$('.ui-widget-content').css('color', fore); } ``` --- ![image](https://github.com/user-attachments/assets/733b2a3f-0962-4632-9df0-c104e9c51eca) --- ![image](https://github.com/user-attachments/assets/a0e7b65b-6998-482a-9cfb-4aa14057963f) --- ## Added to game.js ```js elements = [ '#statusVarsLabel', '#statusVarsAccordion',// '#statusVars', '#inventoryLabel', '#inventoryAccordion', '#inventoryAccordion.ui-widget-content', '#placesObjectsLabel', '#placesObjectsAccordion', '#placesObjectsAccordion.ui-widget-content', '#compassLabel', '#compassAccordion', '.ui-button', //'.ui-button-text', '#commandPane', '#customStatusPane' ]; ``` --- ![image](https://github.com/user-attachments/assets/10a41949-07ab-401d-a88c-b835f5685140) --- ![image](https://github.com/user-attachments/assets/53722528-0e45-477d-9538-a06533c5c4ee) --- ## Added to game.js ```js dirs = ['N', 'E', 'S', 'W', 'NW', 'NE', 'SW', 'SE', 'U', 'In', 'D', 'Out']; commandColour = 'orange' function setElement(name, fore, back) { el = $(name); el.css('background', back); el.css('color', fore); el.css('border', 'solid 1px ' + fore); if (endsWith(name, "Accordion")) { el.css('border-top', 'none'); } } ``` --- ![image](https://github.com/user-attachments/assets/e7e7661b-4919-406e-842a-ff00eed306d1) --- ![image](https://github.com/user-attachments/assets/5cc5ed9a-7cce-40c3-a2a8-c1afca77dea0) --- ## Added to game.js ```js function endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } ``` --- ![image](https://github.com/user-attachments/assets/55bec772-f2a0-45ba-bcde-712a8d99fb7f) --- ![image](https://github.com/user-attachments/assets/6424b92e-0b16-4462-b918-c1f1c0ae2b89) --- ![image](https://github.com/user-attachments/assets/d539e4d8-5540-4bbb-bc7d-2c226e9e9744) --- https://github.com/textadventures/quest/blob/63f159054e088a40b3b22ed1954392c4d3cb9974/PlayerController/playercore.htm#L56C13-L58C19 --- ## Added to index.htm ```html ``` --- ![image](https://github.com/user-attachments/assets/535dad31-6e37-4fdf-931e-07e8b3e95c8b) --- ![image](https://github.com/user-attachments/assets/ea9d6438-ea86-4902-a49e-499fc375ec34) --- ![image](https://github.com/user-attachments/assets/7aec893a-f2e3-4f66-be0f-c4fc3c4a8a66) --- Success?
KVonGit commented 2 months ago

Here are the two modified files (game.js, and index.htm) from the converter's directory:

https://gist.githubusercontent.com/KVonGit/177267e19099ab14510b90e5d45c5271/raw/cf886cdde985e5d26185f6cd32e758d8b6d789c1/game.js

https://gist.githubusercontent.com/KVonGit/c02f1149acebab42c7cce30bfca74e97/raw/4e247058569d0be10476ad75648c3e4981747aa7/index.htm

KVonGit commented 2 months ago

Just uploaded updated game.js and a new release that fixes lots of stuff, probably breaks some stuff too, but I didn't see anything after playing for a couple of minutes.

Closing this one.