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 [2] 3 4 ... 38
16
SCI Syntax Help / Re: SCI0 - Menubar with changing options
« on: October 07, 2022, 01:51:31 PM »
That's brilliant in that it does what I wanted most - the "greyed out" part...that said, I'm still not getting it to become usable when I change the variable...

This is what I am doing
Code: [Select]
(AddMenu
{ Character -}
{Ask About`^a:Retype`#3:--!:Inventory`^I:Death Log`^d:Notes`^n:Switch`^x}
)
(if gSwitchingAllowed
(SetMenu MENU_SWITCH 112 1)
else
(SetMenu MENU_SWITCH 112 0)
)

17
SCI Syntax Help / Re: SCI0 - Menubar with changing options
« on: October 07, 2022, 01:12:50 PM »
Thanks for the link to the info about SetMenu.

I tinkered around with it a bit...but haven't had any success with that one either.

18
SCI Syntax Help / SCI0 [SOLVED] - Menubar with changing options
« on: October 07, 2022, 12:19:49 PM »
I am trying to do one of two things and can't quite get either to work:
1. I am trying to make it so a cretain menu option either shows or doesn't based on a global variable. I have tried something like this, but doesn't seem to work:
Code: [Select]
(if aGlobalVariable
(AddMenu
{ Character -}
{Ask About`^a:Retype`#3:--!:Inventory`^I:Death Log`^d:Notes`^n:Switch`^x}
)
else
(AddMenu
{ Character -}
{Ask About`^a:Retype`#3:--!:Inventory`^I:Death Log`^d:Notes`^n}
)
)
It always gives me the AddMenu without the variable. So is there a command to update the menubar that I need to also do when I change the variable?

- or -
2. Can I show the option in the menubar at all times, but have the option "greyed" out and inactive unless the variable is true. This one I have no idea about at all, but just thought I'd ask anyway. I'd be happy to get either option running.
Thanks

19
Nice! This looks like fun! Can't wait to see it in action  :)

20
Wow! Didn't expect to see a rendering from my game on here! Really cool stuff and thanks for sharing it. I really dig the KQ 4 one at the top, too

21
Again, unless the documentation is wrong, FGets returns the number of bytes read, not the string pointer. So ReadNumber is reading from the wrong thing.

Ok, looks like the documentation might be wrong then... it returns the string pointer, so that part is fine.

Does the "sv plant" thing ring a bell? Are you using the str local variable anywhere else?
The "sv plant" thing kinda went over my head. I thought I'd read a few times to see if I could make sense of it, but I haven't been able to do that quite yet.

Edit: Oh, maybe I do get it now. It'd be reading from the text resource perhaps.... makes me wonder if this isn't just an artifact of terrible naming conventions on my part...I'll have to work these out a little bit to see if I can't fix it, now that I see where the error is coming in.

I also use the str variable in another script where I display the number and kinds of deaths. Here's the procedure:
Code: [Select]
(procedure (deathCountIterator integer)
(Display
(Format @str 650 integer)
dsCOORD 20 textDown
dsFONT 4
)
(= textDown (+ textDown 9))
)

Yes, it looks like this code is actually writing the text resource onto the str...

22
So this is weird. I simply moved the gDeaths array to the top of the variable list and everything seems to be working properly.

But other things are all screwy now...So is there something wrong with how I have declared [str 10]?

23
According to the docs, FGets takes 3 parameters:

http://scicompanion.com/Documentation/Kernels/FGets.html?highlight=fgets

And it returns the number of bytes read, not the string pointer.
Unless you're using some different kernel, or the docs are wrong, it doesn't look like this code works at all?
I run it a series of times:
Code: [Select]
(= fileHandle (FOpen "persist.tmp" 1))
(if (!= fileHandle -1)
(ReadTempFile 0)
(ReadTempFile 1)
(ReadTempFile 2)
(ReadTempFile 3)
(ReadTempFile 4)
(ReadTempFile 5)
(ReadTempFile 6)
(ReadTempFile 7)
)
(FClose fileHandle)
My understanding is that each call will return the next value down the line - which it does appear to do when working properly. Even when it's not "working properly" it still will make the value of the [gDeaths] variable arrays the corresponding numbers (it's just that the numbers are all wrong!)

Edit: from the attachment of the external file, it will set my arrays as follows: [gDeaths 0] = 2, [gDeaths 3] = 1, [gDeaths 6] = 1, and the rest will be 0.

24
I dunno if this helps, but those weird numbers are the following ascii letters:

svp[space]altn

which when you swap the order for each 16bit value (since SCI is little-endian), you get

"vs plant"

Sounds like maybe you overwrote the gDeath part of memory with a string? What variables come before the gDeath array in your global vars?
Thanks for the explanation.
the gDeath array is near the top, but looks like this:
Code: [Select]
(local
fileHandle
[str 10] ; Used to read from an external file and update several variables
[gDeaths 10] = [0 0 0 0 0 0 0 0 0 0]
And the procedure I'm using to "write-in" the variables from the external file is:
Code: [Select]
(procedure (ReadTempFile i)
(= [gDeaths i] (ReadNumber (FGets @str 8 fileHandle)))
)
Is there an issue with this?

25
My external file to keep track of deaths is not quite working properly, to say the least.
I've attached some pictures of the file open in the notepad and the first two look exactly as they should. The first number is the total times died, so the first one is 1, then 2 for the second, but then it goes to 29558 when it should be "3". The other numbers represent certain kinds of death, so there is a "1" in the first, two "1"s in the second picture, and then the numbers go crazy again. The "2" sticks out, but that is correct, as it means the player experienced the same "death" twice. But two of the huge number ones should still be 0.

Any idea how or what might be going on to get these numbers saved out?
My writing out of numbers code looks like this:
Code: [Select]
(= fileHandle (FOpen "persist.tmp" fCREATE))
(if (!= fileHandle -1)
(Format @str "%6d %6d %6d %6d %6d %6d %6d %6d" [gDeaths 0] [gDeaths 1] [gDeaths 2] [gDeaths 3] [gDeaths 4] [gDeaths 5] [gDeaths 6] [gDeaths 7])
(FPuts fileHandle @str)
)
(FClose fileHandle)
One question I do have is what the "6" in "%6d" stands for.

I don't think it's an error in my code to change the variable in the script itself, as my code for that is simply adding by ones:
Code: [Select]
(if (not [gDeaths 6])
(++ gUniqueDeaths)
)
(++ [gDeaths 6])
(= dyingScript (ScriptID DYING_SCRIPT))
(dyingScript
caller: 711
register:
{\nHungry things have to eat. But maybe next time try not letting the food be you!'}
)
(gGame setScript: dyingScript)
It feels like the numbers must be getting mangled in the saving "out" process, but I'm kinda at a loss.

26
SCI Syntax Help / Re: How to "look at" Inventory Items?
« on: June 14, 2022, 02:06:28 PM »
Doesn't there need to be a '/' before the word in the said property? Otherwise it's looking for "hammer" in the first part of the phrase you typed in.

The code needs to do this:
Code: [Select]
(Said 'look>')
followed by this:
Code: [Select]
(Said '/hammer')
which is basically the equivalent of
Code: [Select]
(Said 'look/hammer')
That could be. I will check it out.
Edit 1: Yes, that does help!

Edit 2: I'm getting the same result, which is a "Oops! You tried something we didn't think of" crash error. I was getting that before with Erik's code, so it's not the /hammer part. I wonder if he has more and/or less to his template that's fixing for this. I'll test around and see if I can determine exactly what's causing the crash.

Edit 3: The part that is causing the crash is the "(i ownedBy: gEgo)" and the "(i showSelf:)" I'm guessing variables cannot be used in this way? So any idea what's allowing it to work with Erik's template? He put "i" as a variable to the changeState method, and I followed that example in my code as well.

Good news is that now it's identifying the typed command by the player, now all that's left is how to spit out the correct description.

Edit 4: So I apparently did not put &tmp beofre the i in the method when declaring the variable. Everything now seems to work correctly. Looks like this one is solved. Erik's code works exactly as intended, but Troflip, THANK YOU, I would not have ever thought of the said properties needing the "/" - and that was clearly a huge component of my problems.

27
SCI Syntax Help / Re: How to "look at" Inventory Items?
« on: June 13, 2022, 09:14:26 PM »
What does the said property look like for your inventory items?
Something like this:
Code: [Select]
(instance Hammer of Iitem ; Item 2
(properties
said 'hammer'
description 2
owner 0
view 612
loop 0
cel 0
script 0
name "Hammer"
)
)

28
SCI Syntax Help / [Solved] SCI0 How to "look at" Inventory Items?
« on: June 12, 2022, 11:22:17 PM »
Here's my problem:
When the player types "look at widget," how do I open that item [the widget] as if from the inventory menu? I've looked at the Inv script as well as the following bit of code from ErikorOakford's SCI0 template:
Code: [Select]
((Said 'look[<at]>')
(cond
;look at inventory items
((= i (inventory saidMe:))
(if (i ownedBy: ego)
(i showSelf:)
else
(DontHave)
)
)
But I've been unable to produce anything beyond opening up the menu with all the items listed by using the same command as in the menubar:
Code: [Select]
(gInv showSelf: gEgo) That's nice and all, but I'd like to zero in on the particular item "looked" at by the plater.
Erik's script looks like it should work (and I'm sure it does in his template), but I'm using the standard template, and even correcting for a few differences in naming conventions, I'm still not returning anything that runs.
I know it's actually a fairly simple command, something already there in the template, I'm just not fitting the pieces together and need a hand.
Thanks.

29
SCI Syntax Help / Re: SCI0 - gEgo and barriers
« on: May 25, 2022, 10:56:27 AM »
Going by the later StopWalk's doit, it checks (if (client isStopped:). That's available in the SCI0 template as well, and checks if the actor's mover actually moved. So if you want to detect walking into a barrier, that's how you might do it.
Seems easy enough. I just added "gEgo setMotion: NULL" to trigger from that if statement and that does the trick. Thanks

30
SCI Syntax Help / SCI0 - gEgo and barriers
« on: May 25, 2022, 09:26:10 AM »
Does anyone know where to look to find the programming controlling when gEgo hits a barrier? I find it curious that when gEgo hits a barrier and stops that the command to continue in that direction (say if the barrier is removed) is still active. I would think that movement would be set to null upon hitting a barrier and I'd like to implement this.

So, can anyone point me in the right direction and/or explain any potential problems of implementing such a change/

Pages: 1 [2] 3 4 ... 38

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

Page created in 0.028 seconds with 20 queries.