View unanswered posts | View active topics
|
Page 1 of 1
|
[ 21 posts ] |
|
| Author |
Message |
|
Poi
|
Post subject: Team gate new problem Posted: Fri Jun 23, 2006 12:23 pm |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
Ok here is my script:
Code: use uo; program itemstone( who ) var items := EnumerateItemsInContainer(who.backpack); var pack1 := who.backpack; foreach thing in items if(thing.objtype = 0x99a1) DestroyItem(0x99a1); DestroyItem(0x99a2); DestroyItem(0x99a3); DestroyItem(0x99a4); DestroyItem(0x99a5); DestroyItem(0x99a6); DestroyItem(0x99a7); else CreateItemInContainer (pack1, 0x99a1, 1); CreateItemInContainer (pack1, 0x99a2, 1); CreateItemInContainer (pack1, 0x99a3, 1); CreateItemInContainer (pack1, 0x99a4, 1); CreateItemInContainer (pack1, 0x99a5, 1); CreateItemInContainer (pack1, 0x99a6, 1); CreateItemInContainer (pack1, 0x99a7, 1); endif endforeach
endprogram
My problem: when i step on the gate, it create about 15 of each of these items(i know why) but im not sure how to stop it... Any help?
Note: I know why it creates around 15 of them, don't tell me.
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sat Jun 24, 2006 1:04 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 770 Location: Chicago, IL USA
|
|
hehe... also, DestroyItem needs a reference to the items... Meaning you need to find all of them in the pack before destroying them. You cant just put an objtype in there.
|
|
| Top |
|
 |
|
Gnafu
|
Post subject: Posted: Sat Jun 24, 2006 2:57 am |
|
Joined: Thu Feb 02, 2006 7:29 am Posts: 91 Location: Livorno, Italy
|
---- EDIT ----
Probably the correct version...
----- FIXED CODE -----
Code: use uo; program itemstone( who ) var wpcis:=GetObjProperty(who, "isin");
if(!wpcis) //the cprop does not exists, so the pc is out
var pack1 := who.backpack; local i; var temp:=0x99a0; // useless initialization for (i:=1; i<=7; i:=i+1) temp:=(0x99a0+i); CreateItemInContainer (pack1, temp, 1); endfor SetObjProperty(who, "isin", 1);
else // the pc is in
var items := EnumerateItemsInContainer(who.backpack); foreach thing in items if( (thing.objtype >= 0x99a1) && (thing.objtype <= 0x99a7)) DestroyItem(thing); endif; endforeach EraseObjProperty( who, "isin" );
endif
endprogram
----- FIXED CODE -----
_________________ Gnafu
DRL freelance scripter
Last edited by Gnafu on Mon Jun 26, 2006 11:46 pm, edited 4 times in total.
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Sat Jun 24, 2006 9:40 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
Ill test it and get back to you, thanks for tying 
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Sat Jun 24, 2006 9:52 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
|
Its just a tad bit off from what i want, this one creates the items and when you go back thru deletes them and creates more, but i want it so when they go back thru it only deletes them
|
|
| Top |
|
 |
|
Gnafu
|
Post subject: Posted: Sun Jun 25, 2006 5:06 am |
|
Joined: Thu Feb 02, 2006 7:29 am Posts: 91 Location: Livorno, Italy
|
|
That script destroy or create the objects if they exists or not.
If exists more than one obj, it destroy only one.
If you tell me what does this script must help to do it will better for me to change it according to your wish...
Do you want a pg to have an object to use in a dng and then, when he comes back, destroy it?
And there must be only one ?
give me an example or something as:
"the pg have an empty backpack
he goes thru the gate and he receive an object to use in the zone
when he comes back he cannot bring back the object
so the script must destroy the object."
my questions will be:
"different pg can trade theese objects? or have more than one of each type?"
"how about come back thru with no objects?"
_________________ Gnafu
DRL freelance scripter
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Sun Jun 25, 2006 6:37 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
|
This is exactly what i want to do, i hopw you understand it:
Person goes thru the gate, gets a set of items to use for that zone, when he comes back thru the gate it just destroys those items so he doesnt have them anymore, but next time he comes thru he will get the items agian
|
|
| Top |
|
 |
|
Gnafu
|
Post subject: Posted: Sun Jun 25, 2006 8:22 am |
|
Joined: Thu Feb 02, 2006 7:29 am Posts: 91 Location: Livorno, Italy
|
Done.
I used a cprop to set the pc 'in' or 'out'.
Change the name of the cprop used if 'isin' is used in other scripts or you think 'djbethrstyhryh' , 'dtgdhg' or 'iujfndyb' are better
If the cprop exists, it means that the pc was in, so the script must destroy all the objects.
If the cprop doesn't exists, getobjproperty() returns an error, it means that the pc was out of the zone, so the script must create the items..
Probably in this way it will work but pay attention to some cases:
- The pc already have an object with that objtype
- The pc exit the zone without using the gate (rune, summon by staff..)
Bye bye
_________________ Gnafu
DRL freelance scripter
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Sun Jun 25, 2006 11:33 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
|
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\pol\scripts>ecompile.exe
EScript Compiler v1.03
Copyright (C) 1994-2003 Eric N. Swanson
Compiling: c:/pol/pkg/teamgates/itemstone.src
Your syntax frightens and confuses me.
Your syntax frightens and confuses me.
Error compiling statement at c:\pol\pkg\teamgates\itemstone.src, Line 2
Parse Error: Waaah!
Near: program itemstone( who )
File: c:\pol\pkg\teamgates\itemstone.src, Line 3
Execution aborted due to: Error compiling file
C:\pol\scripts>
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sun Jun 25, 2006 5:03 pm |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 770 Location: Chicago, IL USA
|
|
post the code you used. Theres an error somehwere in it.
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Sun Jun 25, 2006 6:39 pm |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
|
use uo;
program itemstone( who )
var wpcis:=GetObjProperty(who, 'isin');
if(!wpcis) //the cprop does not exists, so the pc is out
var pack1 := who.backpack;
local i;
var temp:=0x99a0; // useless initialization
for (i:=1; i<=7; i:=i+1)
temp:=(0x99a0+i);
CreateItemInContainer (pack1, temp, 1);
endfor
else // the pc is in
var items := EnumerateItemsInContainer(who.backpack);
foreach thing in items
if( (thing.objtype >= 0x99a1) && (thing.objtype <= 0x99a7))
DestroyItem(thing);
endif;
endforeach
EraseObjProperty( who, 'isin' );
endif
endprogram
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sun Jun 25, 2006 9:52 pm |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 770 Location: Chicago, IL USA
|
|
use double quotes instead of single quotes? "isin" instead of 'isin'
|
|
| Top |
|
 |
|
Gnafu
|
Post subject: Posted: Sun Jun 25, 2006 10:57 pm |
|
Joined: Thu Feb 02, 2006 7:29 am Posts: 91 Location: Livorno, Italy
|
ooopppssss....
Another hint...
I was thinking that probably you better set a region on the zone you want this script to run and attach that script on EnterScript and LeaveScript
Region TheFantasticZone
{
Range 1500 1500 1700 1700
Guarded 1
EnterText You receive some objects...
LeaveText You lost some objects...
Midi 9
EnterScript :coords:thezone
LeaveScript :coords:thezone
}
So you can also split the script in two (one for entering and one for leaving)
In this case you do not need to set a cprop on the pc
_________________ Gnafu
DRL freelance scripter
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Mon Jun 26, 2006 6:45 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 770 Location: Chicago, IL USA
|
|
Thats 096 only though Gnafu for the EnterScript/LeaveScript. I think hes on 095.
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Mon Jun 26, 2006 7:02 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\pol\scripts>ecompile.exe
EScript Compiler v1.03
Copyright (C) 1994-2003 Eric N. Swanson
Compiling: c:/pol/pkg/teamgates/itemstone.src
Your syntax frightens and confuses me.
Your syntax frightens and confuses me.
Error compiling statement at c:\pol\pkg\teamgates\itemstone.src, Line 2
Parse Error: Waaah!
Near: program itemstone( who )
File: c:\pol\pkg\teamgates\itemstone.src, Line 23
Execution aborted due to: Error compiling file
C:\pol\scripts>
Code: use uo; program itemstone( who ) var wpcis:=GetObjProperty(who, "isin");
if(!wpcis) //the cprop does not exists, so the pc is out
var pack1 := who.backpack; local i; var temp:=0x99a0; // useless initialization for (i:=1; i<=7; i:=i+1) temp:=(0x99a0+i); CreateItemInContainer (pack1, temp, 1); endfor
else // the pc is in
var items := EnumerateItemsInContainer(who.backpack); foreach thing in items if( (thing.objtype >= 0x99a1) && (thing.objtype <= 0x99a7)) DestroyItem(thing); endif; endforeach EraseObjProperty( who, 'isin' );
endif
endprogram
|
|
| Top |
|
 |
|
Gnafu
|
Post subject: Posted: Mon Jun 26, 2006 7:35 am |
|
Joined: Thu Feb 02, 2006 7:29 am Posts: 91 Location: Livorno, Italy
|
Poi.... -_-'
there is another 'isin' to change...
the compiler tells you the point where the error is ("..line 23")
@CWO : Yep, I didn't remember which version he's using 
_________________ Gnafu
DRL freelance scripter
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Mon Jun 26, 2006 9:07 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
|
Sorry lmao, i was busy and dint bother to read it, just posted it.
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Mon Jun 26, 2006 9:13 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
|
Ok it still does not work, it creates it over and over no matter how many times you walk thru
|
|
| Top |
|
 |
|
Gnafu
|
Post subject: Posted: Mon Jun 26, 2006 10:21 am |
|
Joined: Thu Feb 02, 2006 7:29 am Posts: 91 Location: Livorno, Italy
|
mmmm, tomorrow i will test it...
*thinking*

_________________ Gnafu
DRL freelance scripter
|
|
| Top |
|
 |
|
Burtonius
|
Post subject: Posted: Mon Jun 26, 2006 11:10 am |
|
|
|
add this line before the else statment:
Code: SetObjProperty(who, "isin", 1);
that should fix his script
|
|
| Top |
|
 |
|
Poi
|
Post subject: Posted: Sat Aug 26, 2006 8:13 am |
|
Joined: Fri Apr 14, 2006 9:36 am Posts: 240
|
|
Hey thanks alot, sorry it took me so long to get to this, ive been sort of.... uhm anyway, how would i make ti so it deletes it off thier body too?
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 21 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|