Post new topic    
Slime Knight
Send private message
Arguments passed from fields in CUSTOM. 
 PostTue May 07, 2013 5:05 pm
Send private message Reply with quote
Is there a list somewhere of what arguments are passed automatically when a script is called from somewhere "in-CUSTOM?" (as in, not from another script) I'd really like to know what they all are.

I know NPCs pass "script argument" first and their reference second. (These are wrong in the argument tutorial on the Wiki, by the way...) Do they pass more arguments?

Because I made a very simple script, which had 6 arguments all set to default at -200, and it printed the results to a string. When attached to an NPC, arguments one and two printed with the correct data, but the remaining 4 arguments were all passed 0 for some reason.

Is this a bug? Do scripts called from CUSTOM ignore extra default argument values? Or do NPCs just pass a whole slime-load of arguments I'm not aware of?

Also, while I'm at it can I ask about how the current frame of a walkabout is decided? I'm curious, because i would have thought at a speed of 4, it should always land on the same frame (20 pixels to move / speed of 4 = 5 frames, so 1,2,1,2,1) but it doesn't always land back on 1.
Liquid Metal King Slime
Send private message
Re: Arguments passed from fields in CUSTOM. 
 PostTue May 07, 2013 5:35 pm
Send private message Reply with quote
shakeyair wrote:
Is there a list somewhere of what arguments are passed automatically when a script is called from somewhere "in-CUSTOM?" (as in, not from another script) I'd really like to know what they all are.


This article lists them all: http://rpg.hamsterrepublic.com/ohrrpgce/Script_triggers#Other_Ways_to_Start_a_Script

shakeyair wrote:
I know NPCs pass "script argument" first and their reference second. (These are wrong in the argument tutorial on the Wiki, by the way...) Do they pass more arguments?


Which article is that? I am having trouble finding it. Can you post a link to it?

shakeyair wrote:

Because I made a very simple script, which had 6 arguments all set to default at -200, and it printed the results to a string. When attached to an NPC, arguments one and two printed with the correct data, but the remaining 4 arguments were all passed 0 for some reason.

Is this a bug? Do scripts called from CUSTOM ignore extra default argument values? Or do NPCs just pass a whole slime-load of arguments I'm not aware of?


Hmmm... That is sort of a bug yes. What it really means is that default arguments only matter for scripts you call directly from other scripts. When custom triggers a script the default arguments are never used. That could be considered a bug, or it could just be something that needs to be documented.

shakeyair wrote:

Also, while I'm at it can I ask about how the current frame of a walkabout is decided? I'm curious, because i would have thought at a speed of 4, it should always land on the same frame (20 pixels to move / speed of 4 = 5 frames, so 1,2,1,2,1) but it doesn't always land back on 1.


You are not counting the starting position.

Speed 4 wrote:

* Starting pixel position 0 frame 0
* Moving pixel position 4 frame 1
* Moving pixel position 8 frame 0
* Moving pixel position 12 frame 1
* Moving pixel position 16 frame 0
* Finished pixel position 20 frame 1


If you want the walking frame to be the same at the end of each step, use walking speed 5

Speed 5 wrote:

* Starting pixel position 0 frame 0
* Moving pixel position 5 frame 1
* Moving pixel position 10 frame 0
* Moving pixel position 15 frame 1
* Finished pixel position 20 frame 0



And of course the starting position is the same as the ending position of the previous step.
Slime Knight
Send private message
 
 PostTue May 07, 2013 8:05 pm
Send private message Reply with quote
The error was here:

http://rpg.hamsterrepublic.com/ohrrpgce/What_is_a_script_argument_for%3F#Advanced_stuff

But I changed it to link to the page that you linked me to, instead. That seemed to make more sense.

Huh. It does seem like odd behavior to zero out arguments, but I guess its probably not realistically an issue. I've certainly never noticed it in all my years of using the OHR.

That makes sense about NPC walking, but then how come they don't always end on the opposite frame either? That was really my question. It seems like given an NPC speed, the NPC should always land on the same or the alternate frame, but this isn't the case.

Is there a reason that textboxes don't pass their ID number to scripts run from them? This would be useful, I think.

Maybe I should have named this thread "ShakeyAir's really obscure questions about the OHRRPGCE"
Liquid Metal King Slime
Send private message
 
 PostTue May 07, 2013 9:09 pm
Send private message Reply with quote


Ah, thanks. I should clean up that page more.

shakeyair wrote:

That makes sense about NPC walking, but then how come they don't always end on the opposite frame either? That was really my question. It seems like given an NPC speed, the NPC should always land on the same or the alternate frame, but this isn't the case.


Oh! I was wrong! I just checked the code, and realized that walking frame only changes every 2 ticks, not every 1 tick.

Speed 4 wrote:
* Starting pixel position 0 frame 0A
* Moving pixel position 4 frame 0B
* Moving pixel position 8 frame 1A
* Moving pixel position 12 frame 1B
* Moving pixel position 16 frame 0A
* Finished pixel position 20 frame 0B


Speed 5 wrote:
* Starting pixel position 0 frame 0A
* Moving pixel position 5 frame 0B
* Moving pixel position 10 frame 1A
* Moving pixel position 15 frame 1B
* Finished pixel position 20 frame 0A


Not even speed 2 makes them line up

Speed 2 wrote:
* Starting pixel position 0 frame 0A
* Moving pixel position 2 frame 0B
* Moving pixel position 4 frame 1A
* Moving pixel position 6 frame 1B
* Moving pixel position 8 frame 0A
* Moving pixel position 10 frame 0B
* Moving pixel position 12 frame 1A
* Moving pixel position 14 frame 1B
* Moving pixel position 16 frame 0A
* Moving pixel position 18 frame 0B
* Finished pixel position 20 frame 1A


Thank you for bringing this to my attention. I am not sure if I should call it a bug or not, but the current behavor was certainly never documented anywhere before.

shakeyair wrote:

Is there a reason that textboxes don't pass their ID number to scripts run from them? This would be useful, I think.


No special reason, just nobody asked for it. You can get almost the same effect with the "current text box" command.

shakeyair wrote:
Maybe I should have named this thread "ShakeyAir's really obscure questions about the OHRRPGCE"


Obscure questions are fun to answer!
Slime Knight
Send private message
RE: ShakeyAir's really obscure questions about the OHRRPGCE 
 PostTue May 07, 2013 9:12 pm
Send private message Reply with quote
shakeyair wrote:
Is there a reason that textboxes don't pass their ID number to scripts run from them? This would be useful, I think.

I am not entirely sure what use it would have, it doesn't make too much sense to display the same box again to the user.

The only viable use I can think of, is to create a script dispatcher, whereas you use a single plotscript in CUSTOM for most, if not all textboxes, and let this script determine how it should be handled depending on which textbox is calling it. Or perhaps creating a random NPC response generator by taking the box number and adding a random number from 1-5 to it, and displaying that box. Say if NPC normally says box 50, applying this plotscript would choose an random textbox from 51 to 55. The same script would be used in box 70 to choose a random box from 71 to 75 and so on. This could be used for random item catches in a chest for example. But this behavior is easily emulated without giving the textbox as an argument. I guess it's TMC's and James' call if we as a community need such a feature. They are our overlords afterall, we're stuck with whatever they give us.
Display posts from previous: