generic question thread

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
misterj
Slime Knight
Posts: 124
Joined: Fri Oct 26, 2007 9:12 pm

generic question thread

Post by misterj »

i want a string to position itself on my hero

heropixelx/y don't do this because stringpixelx/y is based on screen location and heropixelx/y is based on map location.


what should i do?
Last edited by misterj on Sun Aug 10, 2008 11:04 pm, edited 1 time in total.
<center><img src="http://i.imgur.com/qXKfH.png" title="CONGRATS ON BIG FOOTBALLS"></center>
User avatar
Mazin
Slime Knight
Posts: 132
Joined: Tue Oct 16, 2007 6:00 am

Post by Mazin »

Of course, the easiest way would just be to make sure the hero is always in the center of the screen (by using a map big enough to never reach the edge or by repeating the default tile on the edge or whatever). Then their location on the screen would never change.

Also possible: use camera pixel x and y to get the location of the camera and use this to find the hero's position on the screen given their position on the map. If the top left corner of the screen is at map coordinates (cx, cy) and the hero is at map coordinates (hx, hy), then the hero should be at screen coordinates (hx - cx, hy - cy) I think.
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

(hero x - camera x, hero y - camera y) will always give you the top-left of the hero's sprite.
User avatar
misterj
Slime Knight
Posts: 124
Joined: Fri Oct 26, 2007 9:12 pm

Post by misterj »

guess i assumed camera pixels referred to the map location too. thanks, should work out nicely... better than the no-wrapping.
<center><img src="http://i.imgur.com/qXKfH.png" title="CONGRATS ON BIG FOOTBALLS"></center>
User avatar
misterj
Slime Knight
Posts: 124
Joined: Fri Oct 26, 2007 9:12 pm

Post by misterj »

next question:
i used remember npc/map state when reloading map. this works fine normally.

except.. if i save the game and come back, the npcs and map changes are reverted. what should i do?

i've set it so that certain tags will fix the walls and such when reloading the sav file, but that doesn't account for the npc locations or states...
<center><img src="http://i.imgur.com/qXKfH.png" title="CONGRATS ON BIG FOOTBALLS"></center>
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Right now there is no way to automatically save map/npc states in a save game. That will happen sometime in the future -- sometime after the save format rewrite.

The only thing you could do now is to use a bunch of global variables to save NPC state-- but that would be a real pain :(
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

I wrote a script for that -- it's "Save NPCs" on the Castle Paradox gamelist. I thought it was obsolete with map states but I guess not.

The big limitation is that in its current form it will only work for one map at a time.
User avatar
misterj
Slime Knight
Posts: 124
Joined: Fri Oct 26, 2007 9:12 pm

Post by misterj »

castleparadox is goddamn slow and does not load. i can't get it.
Last edited by misterj on Tue Aug 12, 2008 10:57 pm, edited 1 time in total.
<center><img src="http://i.imgur.com/qXKfH.png" title="CONGRATS ON BIG FOOTBALLS"></center>
User avatar
misterj
Slime Knight
Posts: 124
Joined: Fri Oct 26, 2007 9:12 pm

Post by misterj »

okay, eventually i got it. i suppose it'd take away 1/4 of the globals but for now it isn't worth using. i'm just... gonna have to make good use of locations to save for now.

next q: is there a way to close text boxes called from menus besides using tags or scripting? using those could be a real hassle but if it's the only way...
another q: some of the textboxes that the menu links to needs 2 text boxes to show all info -- but when you hit enter to continue the box, it just re-does the first text box. i suppose both of these problems are related...

q3: what is up with menu positioning? for some reason it just isn't very consistent at all.. it might look fine in custom.exe but in game.exe it ends up being off.

edit: and i'm using the last stable release, in case that ever comes up.
Last edited by misterj on Wed Aug 13, 2008 10:42 pm, edited 3 times in total.
<center><img src="http://i.imgur.com/qXKfH.png" title="CONGRATS ON BIG FOOTBALLS"></center>
User avatar
Mogri
Super Slime
Posts: 4598
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

Not anymore -- there are now 4000+ globals. It may be more worthwhile with the extended globals.
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Monochrome's Last Stand wrote:next q: is there a way to close text boxes called from menus besides using tags or scripting? using those could be a real hassle but if it's the only way...
No, but I agree there needs to be a way.
Monochrome's Last Stand wrote:another q: some of the textboxes that the menu links to needs 2 text boxes to show all info -- but when you hit enter to continue the box, it just re-does the first text box. I suppose both of these problems are related...
Yep. Textboxes need to be able to open up on top of menus too. There will probably have to be a new textbox property for "Opens on top of menus" and "Opens underneath menus"

All old textboxes will need to default to "under menus" for backwards compatability, but I'll probably make new textboxes default to "opens over menus" since that is likely to be the most common usage case.
Monochrome's Last Stand wrote:q3: what is up with menu positioning? for some reason it just isn't very consistent at all.. it might look fine in custom.exe but in game.exe it ends up being off.
Can you give me a more specific example of how it is "off"?
Monochrome's Last Stand wrote:edit: and i'm using the last stable release, in case that ever comes up.
Bless you for saying so without having to be asked :)
User avatar
misterj
Slime Knight
Posts: 124
Joined: Fri Oct 26, 2007 9:12 pm

Post by misterj »

actually, i figured out what the deal is @ q3.
it's because when i positioned the menus, they were anchored in the center. in game, two of the options from the menu are disabled and don't show up, so it moves back towards the center. i just need to anchor from the top.

but... yeah, the text boxes thing. :(



now i'm working from something i've split from about 8/13 but i try to keep it up to date.
<center><img src="http://i.imgur.com/qXKfH.png" title="CONGRATS ON BIG FOOTBALLS"></center>
User avatar
Bob the Hamster
Liquid Metal King Slime
Posts: 7460
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Monochrome's Last Stand wrote:but... yeah, the text boxes thing. :(
<a href="http://rpg.hamsterrepublic.com/bugzilla ... d=531">Bug 531</a> is a priority of mine for the Xocolatl release.

If you want a tacky hack to get you through until then, try something like this:

Code: Select all

plotscript, boxey menu, textbox number, begin
  variable&#40;line, menu, mi, str&#41;
  str &#58;= 0 # just need a string ID for temporary use
  menu &#58;= create menu
  for &#40;line, 0, 7&#41; do, begin
    mi &#58;= add menu item&#40;menu&#41;
    string from textbox &#40;str, textbox number, line, true&#41;
    set menu item caption&#40;mi, str&#41;
  end
end
EDIT: fixed a typo
Last edited by Bob the Hamster on Wed Aug 27, 2008 6:16 pm, edited 1 time in total.
Post Reply