Visit the Ironworks Gaming Website Email the Webmaster Graphics Library Rules and Regulations Help Support Ironworks Forum with a Donation to Keep us Online - We rely totally on Donations from members Donation goal Meter

Ironworks Gaming Radio

Ironworks Gaming Forum

Go Back   Ironworks Gaming Forum > Ironworks Gaming Forums > Dungeon Craft - RPG Game Maker
FAQ Calendar Arcade Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 05-22-2010, 03:42 PM   #1
SilentThief
Symbol of Cyric
 
Burger Time Champion
Join Date: September 10, 2001
Location: USA
Age: 48
Posts: 1,301
Question Mark Script debugging

So, I know we have a few people who are more script savvy than me, and I was wondering what I was doing wrong with this script:

$VAR Count;
Count = 0;

$WHILE (Count < ($MINUS($PARTYSIZE(), 1)))
{
$SET_CHAR_STATUS(Count, "2");
Count = (Count + 1);
};
$RETURN;

Theoretically, it should run thru a loop making each character status "2" (dead) in the party and end when reaching the partysize. But it does not, and I get a GPDL error saying 11 members in party is illegal. This means that the script is failing to exit the loop (as in stop loop when count is no longer lesser than partysize -1).

Any ideas?
ST
ps, does this also mean we may someday have 10 people in the party???
__________________
http://www.wilhelmscream.net/
SilentThief is offline   Reply With Quote
Old 05-22-2010, 05:35 PM   #2
manikus
Jack Burton
 

Join Date: July 13, 2001
Location: Stumptown
Age: 53
Posts: 5,444
Default Re: Script debugging

Well, first off, DC doesn't support $WHILE - maybe you can use it in a conversation (talk.bin) which uses GPDL in a slightly different way (more can be done).

Second thing I notice is that you don't need to use $MINUS, and in fact shouldn't. I'll let Paul explain why. It should just be $PARTYSIZE()-#1

Third, $SET_CHAR_STATUS is used wrong - it needs an actor
$SET_CHAR_STATUS($Target(),"2")

Lastly, it's not an error, but you don't need $RETURN, it's implied.

I just don't know how to make this loop.

But, if the idea is to kill the whole party, by setting their status to "2" and not giving damage, you should try using a party ASL - since it effects the whole party.
__________________
manikus is offline   Reply With Quote
Old 05-22-2010, 10:11 PM   #3
Paul Stevens
Drow Warrior
 

Join Date: July 8, 2003
Location: Madison, Wisconsin
Age: 85
Posts: 296
Default Re: Script debugging

$VAR Count;
Count = 0;

//Nice. Declare a variabel named 'Count' and set it to "0".
// Remember!!!!!! Everthing in GPDL is a string. (White
//lie alert!). At any rate.....GPDL kindly converted the
//zero to a string, saving you two keystrokes and the
//associated shifts.


$WHILE (Count < ($MINUS($PARTYSIZE(), 1)))

//Not too bad.....Let us say the party size is
// three. That is "3". Remember everthing is a
//string. But $MINUS converts strings to numbers
//and back again....So the result is "2".
//This works pretty well....even though you
//meant to compare numbers, you were actually
//comparing strings. Nevertheless, "0" is less
//than "2". "1" is less than "2". In dictionary
//order. So all is well. If the numbers had gotten
//as high as ten, however, we would find that
// "10" is less than "2".
// Perhaps you should have used a numeric
//comparison rather than a string comparison.
// Count <# ($MINUS($PARTYSIZE(), 1))
// And Manikus is right. $MINUS is designed to
// operate on very large numbers. It would be
// a rather slow and inefficient way to subtract
// small numbers ( less than about 2 billion ).

{
$SET_CHAR_STATUS(Count, "2");

//Now it gets complicated. What is count? It
//can mean one of two things!!!!! Neither of which
//is what you want!
//
// In combat it is the combatant number. It probably
//will be equal to 0, 1, 2, 3, etc for the party
//and then continuing with higher numbers for the
//monsters. But you should not count on it.
//
// In adventure it is the unique id of the party
//member and could be anything. 12, 22, 97, 103.
//

Count = (Count + 1);

//Here, my friend, is the big mistake. Remember that
//everything is a string. "0" + "1" is "01";
//"01" + "1" is "011".
//
// You should probably use an arithmetic plus...
// Count = (Count +# 1);

};
$RETURN;

Last edited by Paul Stevens; 05-22-2010 at 10:47 PM.
Paul Stevens is offline   Reply With Quote
Old 05-23-2010, 07:39 AM   #4
SilentThief
Symbol of Cyric
 
Burger Time Champion
Join Date: September 10, 2001
Location: USA
Age: 48
Posts: 1,301
Default Re: Script debugging

Quote:
Originally Posted by Paul Stevens View Post

Count = (Count + 1);

//Here, my friend, is the big mistake. Remember that
//everything is a string. "0" + "1" is "01";
//"01" + "1" is "011".
And hence the partymember 11 reference in the error message. gotchya. While GPDL is a computer language and it shows its similarity to C (and C++ which I'm a noob at) and perhaps Basic (which I know real well), it has its differences; and being that EVERYTHING is a string is something that cannot be stressed enuff. I think this has been the problem with all my scripts that should have worked in the past but didn't.

So, I'm to assume a properly set up $WHILE statement won't work fine? are there other loop processes? FOR/NEXT? or GOTO/GOSUB? I know there were functions that GPDL can use that were not listed in the old help file (wherever that may be ), and I just got a copy of my old attempt at cataloging all of them, and I can list some if you want (like CONTINUE and RESPOND, from the conversation ability of GPDL). Of course, you prolly know more about it than me since you wrote it

Thanx for the help! Chances are, I'll have a few more posts to this in the near future
ST
__________________
http://www.wilhelmscream.net/

Last edited by SilentThief; 05-23-2010 at 07:46 AM. Reason: major rehash, added a few things ;)
SilentThief is offline   Reply With Quote
Old 05-23-2010, 09:41 AM   #5
Paul Stevens
Drow Warrior
 

Join Date: July 8, 2003
Location: Madison, Wisconsin
Age: 85
Posts: 296
Default Re: Script debugging

Quote:
So, I'm to assume a properly set up $WHILE statement won't work fine?
Why not? It should work. If it doesn't,
we'll fix it. $WHILE is documented and
has worked for me.

Your problem is that the party members are
not necessarily numbered 0,1,2,3. Except in
combat. You did not say whether youir script
was designed for a combat setting. We very
definitely need to do something about this
because the documentation is wrong and it
is most confusing for you , me, and anyone
attempting to create scripts.

In combat, there is a function to get the
next combatant and you can put it into
a $WHILE loop until there are no more.
$WHILE (next) {};
Perhaps we should do the same for the
adventuring party. and attempt to change
the documentaion. And add lots of
warnings to the documentation!!!! Because
the simple 0,1,2,3....method will appear to
work well most of the time!!! Perhaps I
should change the code to make 0,1,2,3
NEVER work.

The problem is that the current code allows
a party member to retain his identity as
other party members come and go. If, for
example, there are members 0, 1, 2, and
3 and party member (1) leaves the party,
then party members (2) and (3) retain their
identity and party member (2) is missing.
So the party size will become three and
the members become 0,2,3. Is this valuable?
Perhaps we should change the code so that
it is much simpler. After party member (1)
leaves then the identity of (2) and (3) will
become (1) and (2).

Oh, dear......difficult choices.
Paul Stevens is offline   Reply With Quote
Old 05-24-2010, 07:13 AM   #6
SilentThief
Symbol of Cyric
 
Burger Time Champion
Join Date: September 10, 2001
Location: USA
Age: 48
Posts: 1,301
Default Re: Script debugging

The $WHILE script example I gave was not used for combat, it was only used for just walking around.

Quote:
Originally Posted by Paul Stevens View Post

The problem is that the current code allows
a party member to retain his identity as
other party members come and go. If, for
example, there are members 0, 1, 2, and
3 and party member (1) leaves the party,
then party members (2) and (3) retain their
identity and party member (2) is missing.
So the party size will become three and
the members become 0,2,3. Is this valuable?
Perhaps we should change the code so that
it is much simpler. After party member (1)
leaves then the identity of (2) and (3) will
become (1) and (2).
That seems strange. I mean, I don't think that was how that was supposed to be done. I don't know, though. The documentation from the last version was a little unclear about how to reference a partymember (I'm going by memory, as I have the newer beta version and windows 7 does NOT supprt .hlp files). I swear I remember something like

$GIVE_CHAR_ITEM(0, "Wimpy Axe");

would give the first partymember (slot zero) the axe and also reading that it would give the active partymember the axe. But you are saying that if a member of the party were removed from the game then the designer could give a call to give an item to that member of the party?
Wouldn't that throw an error message? referring to a non-existant partymember?

Using your example, in my opinion the references should reset to 0,1,2 instead of having partymembers 0,2,3. But again, thats my opinion.

ST
__________________
http://www.wilhelmscream.net/
SilentThief is offline   Reply With Quote
Old 05-24-2010, 09:57 AM   #7
Paul Stevens
Drow Warrior
 

Join Date: July 8, 2003
Location: Madison, Wisconsin
Age: 85
Posts: 296
Default Re: Script debugging

Well, sir, I have been pondering
this for the last 24 hours or so.
I have come to agree with you.

I very much doubt that anyone
has taken advantage of the unique
identity provided by the code. If
some existing script depends on it,
I will provide conversion functions.

Here is a little 'gotcha'. We will change
this to be party index rather than
PC id. Let us say you do the following:

size = $PARTYSIZE
$WHILE(index <# size)
{
------
$IF (index == 1) delete party member 1
-------
index = index +# 1;
};

Do you see what happens?
Your code never examines party
member(2). Do you see why?
And you will get an error when the
index exceeds the partysize. Do
you see why?
But I suppose scripts are unlikely
to get caught in such traps.

Until you get a version that uses
index rather than id, you can probably
proceed as if it were indexes because
things only get screwed up if a party
member leaves the party and no other
is added.

Last edited by Paul Stevens; 05-24-2010 at 10:02 AM.
Paul Stevens is offline   Reply With Quote
Old 05-24-2010, 04:16 PM   #8
manikus
Jack Burton
 

Join Date: July 13, 2001
Location: Stumptown
Age: 53
Posts: 5,444
Default Re: Script debugging

So, Ive never gotten $WHILE to work in the editor or engine, but I have gotten it to work in the conversation feature (talk.bin).

As it's been a while, I should try again. I have noticed that in the latest version of the editor, that $WHILE is not listed as a possibility in the script editor.

I'll let you know...I'm gessing that I just wrote a bad script before, with lots of variations that were also bad. Now, I will use a good script.
__________________
manikus is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Paladin AI Script Dundee Slaytern Icewind Dale | Heart of Winter | Icewind Dale II Forum 15 12-08-2003 01:08 AM
Script help Lord Splynncryth Dungeon Craft - RPG Game Maker 2 09-15-2002 11:35 PM
Script Wedin Icewind Dale | Heart of Winter | Icewind Dale II Forum 3 04-06-2002 02:14 PM
Script Questions kopema Icewind Dale | Heart of Winter | Icewind Dale II Forum 11 06-10-2001 05:42 AM
script writing slackerboy Baldurs Gate II Archives 8 03-11-2001 10:52 AM


All times are GMT -4. The time now is 03:22 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved