View previous topic :: View next topic |
Author |
Message |
Guest
|
Posted: Mon Oct 20, 2003 4:11 pm Post subject: Calling Scripts |
|
|
This is a question about calling scripts. But it's not the normal question for calling scripts, so hang on.
Every script (well, not autonumber scripts) has an ID number, right? That's how the OHR manages script references internally -- and it's also the order in which scripts are cycled through when selecting a script to be called.
The normal way to call a script is to type its name.
Can you also call a script by using its ID number in some fashion?
The way that I imagine using this kind of capability is, let's say that there's a certain point in a script where you want to call another script. However, which script that is depends on game variables. Because of that, you can't 'hardwire' the script call into the plotscript.
One solution would be to use a whole bunch of if-then statements to check the value of the variable(s) and call the appropriate script.
Another solution (and this is the one my question involves) would be to use a function that goes something like this:
call script (scriptnum) #where scriptnum is the ID number of the script
Do we have a plotscript command that does this that I have unwittingly skipped over, or do we not? I know that you can't just type the ID number, but maybe there's another way... |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Mon Oct 20, 2003 8:35 pm Post subject: |
|
|
Well, just putting the number might work anyway, I'm not sure. Perhaps you could test it? |
|
Back to top |
|
 |
Flamer The last guy on earth...

Joined: 04 Feb 2003 Posts: 725 Location: New Zealand (newly discovered)
|
Posted: Tue Oct 21, 2003 2:25 am Post subject: |
|
|
scripts can calling other scripts (autonumber or otherwise) only with the script's name... there is no command that i know of that would call a script by using it's number. _________________ If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch
(no offense to anyone that was mentioned) |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Tue Oct 21, 2003 6:51 am Post subject: |
|
|
Oh for crying out loud...it logged me out for that post too?
Oh well; thanks guys. I'll experiment around. |
|
Back to top |
|
 |
Minnek Conjurer

Joined: 03 Jun 2003 Posts: 430 Location: Somewhere
|
Posted: Tue Oct 21, 2003 7:36 am Post subject: |
|
|
Could always make your own lil function...err...script that has a bunch of hard coded (I believe that's the term. A little rusty with my jargon and lingo and such n' such fancy talk.) if-then statements, then have it pass a variable into it. I'm not really at a good location to give an example of the variable thing... so I'll leave that off until I get to a better computer.
*glares at the parental lock thingy newly placed upon his computer* I have no idea why I'm not allowed to download on here... or maybe I do. What, I only contracted 6 viruses! The other computer has at least a hundred! I don't know what they're worried about. ...right, that's just spam. I'll stop.  _________________ * SDHawk has joined #Minnek
SDHawk> AAAAAAAAAAAAAUUUUUUUUUGH
* SDHawk has left #Minnek (Leaving) |
|
Back to top |
|
 |
Sephyroth Renegade Rebel Redmage Class A Minstrel

Joined: 04 Feb 2003 Posts: 644 Location: Schmocation
|
Posted: Tue Oct 21, 2003 7:40 am Post subject: |
|
|
I've thought about something like this for a game I was planning once too. There is no real function in the original script, but if you want to assign numbers to the original functions in a "call script (id)" function, you could do something along these lines...
Quote: | define script(-1,call script,5,0,0,0,0,0) #where the first variable would be the id of the script, and the rest would be variables that you might want to use when you run the script.
script,callscript,id,var1,var2,var3,var4,begin
#I didn't memorize all the plotscripts in the dictionary, but I'll just give a basic idea here.
if(id==1) then(walk hero(var1,var2,var3))
if(id==2) then(show text box(var1))
#....I wrote this script off the top of my head so don't expect it to actually work.
|
And so on and so forth, until you assign an ID to each command, by the end of which you should be able to summon any command you want.
In the original plan for my game, I wanted a script that ran another script depending on which map I was on, except instead of linking the ids to the plotscr.hsd functions, I linked them instead to scripts within game's script that correspond with which script I want to load. _________________ im realy ded  |
|
Back to top |
|
 |
Setu_Firestorm Music Composer

Joined: 26 Mar 2003 Posts: 2566 Location: Holiday. FL
|
Posted: Tue Oct 21, 2003 12:47 pm Post subject: |
|
|
Personally, if I were you, I'd avoid the freaky, possibly impractical stuff and just make the script that you are calling an autonumber script. That's the best and easiest way to do it.
That way, you don't have to worry about remembering it's ID number, but rather just typing in the name and Bam! It's up. _________________
Facebook: http://www.facebook.com/georgerpowell
Newgrounds: http://setu-firestorm.newgrounds.com |
|
Back to top |
|
 |
Flamer The last guy on earth...

Joined: 04 Feb 2003 Posts: 725 Location: New Zealand (newly discovered)
|
Posted: Tue Oct 21, 2003 9:24 pm Post subject: |
|
|
i agree with setu on this one.
the only reason i can think of that could possibly be a reason on why you need this is because you're global variable name clashes with the script names, but that shouldn't be a case. _________________ If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch
(no offense to anyone that was mentioned) |
|
Back to top |
|
 |
Mad Cacti (guest again) Guest
|
Posted: Tue Oct 21, 2003 11:15 pm Post subject: |
|
|
I wanted such a function for exactly the same reason as you. I even put a suggestion for it in the suggestion box.
He means calling scripts by id, not functions. |
|
Back to top |
|
 |
Mr B
Joined: 20 Mar 2003 Posts: 382
|
Posted: Wed Oct 22, 2003 11:06 am Post subject: |
|
|
No no no...you (Flamer & Setu) didn't read what I meant.
I said that I couldn't hardwire it. (well I could, but my question rests on the assumption that I won't do that) Were I can't just type in its name. I just want to know if I can do it that way.
It would be quite useful.
Though I suppose that I'll just have to do a big fat if...then structure. Woe are I.  |
|
Back to top |
|
 |
EmCee Guest
|
Posted: Wed Oct 22, 2003 7:34 pm Post subject: |
|
|
Unfortunitly, yes, you do. My worst nightmare. |
|
Back to top |
|
 |
Minnek Conjurer

Joined: 03 Jun 2003 Posts: 430 Location: Somewhere
|
Posted: Thu Oct 23, 2003 12:35 am Post subject: |
|
|
All those brackets, ends, begins, ('s and )'s make my head hurt. Does plotscripting allow for switch/case statements? If not I think I know what I can mess with  _________________ * SDHawk has joined #Minnek
SDHawk> AAAAAAAAAAAAAUUUUUUUUUGH
* SDHawk has left #Minnek (Leaving) |
|
Back to top |
|
 |
Setu_Firestorm Music Composer

Joined: 26 Mar 2003 Posts: 2566 Location: Holiday. FL
|
|
Back to top |
|
 |
eldritch Archmage of Mayhem and Plotscripting

Joined: 18 Sep 2003 Posts: 62 Location: Chicago Area
|
Posted: Thu Oct 23, 2003 8:08 am Post subject: |
|
|
Just a side note for the nasty 'if-then' statements and parenthesis management, one could type up the script in a program that allows color and actually color-code the bloody things. Also, always remember to make the closing parenthesis immediately after you make the opening one so you don't forget to add it again. _________________ "Live by the dice, die by the dice."
"I'd tell you but then I'd turn into a badger."
"Semper Fideles means 'we eat our dead.'"
-Anonymous marine |
|
Back to top |
|
 |
Flamer The last guy on earth...

Joined: 04 Feb 2003 Posts: 725 Location: New Zealand (newly discovered)
|
Posted: Thu Oct 23, 2003 9:52 pm Post subject: |
|
|
true to that eldritch. never forget to add the end or ) to the then statements, it's annoying as heck to find it.
minnek, if you think a few brackets to call scripts is annoying, wait until your try making a custom menu or custom battle, it's filled with so many brackets it makes that small if statement look like a drop of water compared to a flood. _________________ If we were a pack of dogs, IM would be a grand Hound, CN would be a very ficious little pitball, and Giz...well, it doesn't matter breed he is, he'd still be a bitch
(no offense to anyone that was mentioned) |
|
Back to top |
|
 |
|