Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Doan Sephim

Pages: 1 ... 5 6 [7] 8 9 ... 37
91
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 13, 2020, 11:50:41 AM »
Okay! I have the code reading the file numbers into the variables now, so that's good! I'm just not finding the right place to PUT that code. I originally was putting in the Game script's "replay" method, but I don't think that's the right place. I'll keep looking.

So this is getting tricky. Basically, I don't think there is any method or procedure that runs exclusively when you restore the game, which is where I would need to put the code to re-orient the variables.

So the work-around would be to set up a variable (gRestoringTheGame) which I set to TRUE when I restore the game. Then in the Main Script's doit method, I check if this variable is true, run the "read the variable from the temp file" code, then set gRestoringTheGame back to FALSE.

Of course, the obvious hurdle I forgot about was that gRestoringTheGame ITSELF would be set back to FALSE upon the restore of the game, and then the doit method wouldn't read it as TRUE and run the code.

So, I have to write gRestoringTheGame into the Temp file also, then in the Main Script's doit method, read the Temp file for gRestoringTheGame to make it TRUE, which will in turn trigger to read the rest of the Temp file for the other variables, then set gRestoringTheGame to false, so it's not repeating this process every cycle of the game...and while I know this sounds superfluous, it's not.

If you start a new game and there is not gRestoringTheGame flag to stop the constant writing of variables from the temp file, the new game's variables will be overwritten before the player even does anything.

92
SCI Syntax Help / Re: SCI01 Game Using SCI0 Template?
« on: December 13, 2020, 11:13:03 AM »
Is it that different? I figured everything would be mostly the same apart from additional features like scrolling screen transitions and stuff.
Maybe I oversimplified. Eric had mentioned this in the Betrayed Alliance 2 Development Journal post:
An idea could be to move to SCI0.1 (which is what QFG2 uses). It fully supports SCI0 views and pics, but sounds will need to be upgraded to the SCI1 format. It also manages memory much more efficiently - between my SCI0 and SCI01 templates, SCI0 has 20618 bytes of free heap space in the test room, while SCI01 has 29456 bytes of free heap - nearly a 9000 byte difference!
SCI01 also has the doVerb method, which can be mapped to parser commands, as used in KQ1SCI and QFG2, as well as support for polygon-based paths.
Just an idea if it turns out heap space will be a problem.
So maybe it doesn't *have* more space, but manager the space it has better? But I guess I would be running into some weird internal problems if I tried to use the SCI0 scripts in the SCI01 frame. I should just stick with what I know and not make things overly complicated for myself

93
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 08:39:10 PM »
You're a wealth of knowledge! I'll keep muddling

94
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 07:32:35 PM »
One thing you could try is to open the persist file in Notepad to check what's actually in there.

I viewed the tmp file with notepad and it looks like it recorded the variables perfectly! the first value was 3 and the other two values were 1's (which is what they were originally designated as in the main script). So it looks like all I need to do is get the inputting of these values correctly in the replay method.

The current code only pulls "0" values for the variables. I'm not sure what's going wrong though

Code: [Select]
(= fileHandle (FOpen "persist.tmp" 1)) ;there's a historical typo in SCI.SH
(if (!= fileHandle -1)
(= gPersistMe (ReadNumber (FGets @str 8 fileHandle)))
(= gAlsoMePlz (ReadNumber (FGets @str 8 fileHandle)))
)
(FClose fileHandle)

Does it have anything to do with the "historical typo"? Mentioned in the comment?

95
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 06:01:29 PM »
This is about as far as I can help.
Thanks. I appreciate all the help. I'm going to tinker about with it to see if I can get it running smoothly

96
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 05:14:24 PM »
Right. I was missing something obvious.

Code: [Select]
(= fileHandle (FOpen "persist.tmp" 1)) ;there's a historical typo in SCI.SH
(if (!= fileHandle -1)
(= gPersistMe (ReadNumber (FGets @str 8 fileHandle)))
(= gAlsoMePlz (ReadNumber (FGets @str 8 fileHandle)))
)
(FClose fileHandle)

With this in the replay method, I also need to add str as a variable correct?

Also, what does the 8 stand for in the FGets?

Assuming I am saving 3 variables, how does it know which value to assign to each variable? Or does it just go in order?

EDIT: Good and bad news. I succesfully restored the game with a variable of a different value than saved. Bad new? It was the wrong value. I assigned it to 3 just before running the save to file code, but when I checked it after restoring, it said the value was 0. (I had the value set to 1 originally)

97
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 04:59:33 PM »
That's good to know. I'm glad I won't be making tons and tons of new files.

Having some trouble with the code though

Code: [Select]
  [Error]: Expected something to which we could get a pointer: str  Line: 215, col: 15
  [Error]: Expected something to which we could get a pointer: str  Line: 216, col: 25

These errors are in reference to:
Code: [Select]
(Format @str "%6d %6d %6d" gPersistMe gPersistMeToo gGuessWhat)
(FPuts fileHandle @str)

I simply added the variables to the main Script without definition. Am I missing an obvious step?

98
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 04:42:38 PM »
...and then I realize there is apparently no "delete" in SCI0, so you're stuck with a leftover file. Hm.
I look forward to tinkering around with this. Thank you for doing the leg-work, because there is 0.01% chance I would arrive at this info on my own.

As to your comment about no "delete" mechanism in SCI0 - would that suggest that it would create a new file every time there was a restore? I guess this wouldn't be terrible if I just created a folder that stored them...but then again, how would it know which file to read from on the restore?

99
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 04:08:32 PM »
Edit: I just got an idea on how to make certain variables not reset. What you could try to do is have Game::restore write the specific globals you want to persist to a file. You do this right before the (RestoreGame objectName gameNum gVersion) call. Then in Game::replay, somewhere at the start, you check for that file's existance, read the values for those same globals back in, and delete the file. That way, if your persistent global was, say, 42 at the time you decide to restore, it'll save that 42 to the temp file, restore the game and reset the global to whatever that savegame says it was at the time (41?), and then immediately see the file and load 42 from it.
Thanks. I appreciate you explaining the goings on when the game restores. You mentioned "writing the specific globals to a file." I wonder if that is similar to how QFG allowed you to import characters - by writing certain variables to files?

Do you know how one would accomplish the writing of a variable to a file? I would like to test this out, but don't know how to do that (or check it for that matter).

100
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 03:42:22 PM »
I have looked at it and that is not the solution.

The anti-scum measures in Iceman use the replay method of the minigame's room to detect that you restored a game and increases an ordinary local variable. This doesn't normally happen but Iceman's Game::replay has the line (gRegions eachElementDo: #replay) in it. The dice game's restore counter is saved and loaded as any, then incremented and checked. And that's how it can tell.
Thanks for looking Kawa. You saved me time and trouble.

I've not had any further success finding anything about "RestoreGame." It looks like a procedure, but maybe it's something else? There doesn't seem to be anything like it in any of the Scripts the Game Script uses (or subheaders for that matter).

101
SCI Syntax Help / Re: SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 03:01:49 PM »
Have you thought of looking in Codename: Iceman's scripts? IIRC, it has cheating prevention mechanism in the submarine that maintains its state even after restores.
That's very interesting. I have not looked at it. I will try, but I'm not the most savvy programmer, so I may overlook the solution even if it's there!

102
SCI Syntax Help / [SOLVED] SCI0 - Variables that aren't reset by Restore
« on: December 12, 2020, 12:39:56 PM »
Is it possible to tweak Restore in such a way that it doesn't reset certain variables?

Code: [Select]
(method (restore &tmp gameNum oldCursor hSound)
(= gameNum  -1)
(Load rsFONT gSaveRestoreFont)
(Load rsCURSOR gNormalCursor)
(Load rsCURSOR gLoadingCursor)
(= oldCursor (self setCursor: gNormalCursor))
(= hSound (Sound pause: 1))
(if (GetSaveDisk TRUE)
(if gPrintDlg (gPrintDlg dispose:))
(= gameNum (Restore doit: &rest))
(if (!= gameNum -1)
(self setCursor: gLoadingCursor)
(if (CheckSaveGame objectName gameNum gVersion)
(gCast eachElementDo: #dispose)
(gCast eachElementDo: #delete)
;(= saved 1)
;(FormatPrint {Saved %u} saved)
        (RestoreGame objectName gameNum gVersion)

This is in the "Game" script and I have set a test global variable there "(saved =1)" and I test a print to make sure it works before the "RestoreGame" is called. I do get confirmation that the variable is set to 1 before the restore, but after the restore it is predictably set back to its original value.

I looked everywhere in vain to find where "RestoreGame" is set up. It looks like a procedure to me, but I can't find it anywhere.

103
SCI Syntax Help / Re: Telephones
« on: December 12, 2020, 09:03:33 AM »
I like the idea of a graphical input, like a number pad. Then, instead of checking a large number against their input, you could check each number against 8 individual variables (or just an array of variables more likely)

Alternatively, if you want to stick with inputting a number via typing, you could prompt the first 3 numbers, then the last 4, and check those 2 inputs as they would be more manageable number sizes.

104
SCI Syntax Help / SCI01 Game Using SCI0 Template?
« on: December 11, 2020, 08:32:07 AM »
Quick counter-intuitive question: Is it possible to make an SCI01 game using the standard SCI0 Template?

I know it's counter-intuitive and it'd make more sense just to use the SCI01 Template that Eric has provided, but not being a programmer and there being no tutorials or anything for the SCI01 template, I have found it to be too difficult for me.

That being said, the additional 9000 byte increase in heap space SCI01 offers is something that would make my life a lot easier!

So the question is, can I get that heap while also using the older SCI0 Template?

105
SCI Community How To's & Tutorials / Re: Retry/Restore/Quit Death Dialog
« on: December 10, 2020, 07:00:43 PM »
Nevermind. I'm just going to go with the newer template

Edit: I now remember why I didn't stay with the newer template - nothing I have works anymore and it's not just naming conventions that are different - some of the guts are different too. I'm can't devote the time necessary to become conversant with it as my expertise level in programming is very low and I have to focus on all the other design aspects of the game.

I'm going to have to skip the template upgrade for now, and I will have to shelf this cool new functionality for the time being as well.

Pages: 1 ... 5 6 [7] 8 9 ... 37

SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.021 seconds with 20 queries.