Page 1 of 3
Yet another one of the 100's of problems.
Posted: Sun Apr 23, 2006 6:23 am
by Poi
When i insert runes or anything into a rune book, it just says, You cant put that in a runebook.
Heres the part that makes it say that:
Code: Select all
if(item.objtype == 0x1f14)
AddRune(who, book, item);
elseif(item.objtype == 0x1f4c);
rechargebook(who, book, item);
else
SendSysMessage(who, "You cant put that in a runebook.");
MoveItemToContainer(item, who.backpack);
endif
Posted: Sun Apr 23, 2006 8:34 am
by Tritan
Then your objtype is not correct for your rune.
Posted: Sun Apr 23, 2006 9:26 am
by Damien
I got same problem and the objtype match the rune
Posted: Sun Apr 23, 2006 9:28 am
by Poi
Yeah objtype matches
Posted: Sun Apr 23, 2006 12:10 pm
by Tritan
The objtype you are checking is not correct. Once the rune is marked check the objtype again. In your script you are comparing it to 0x1f14. Maybe your runes are truely 0x1f15 after you mark them, that is the other number for a rune.
When in doubt start putting some debug code in your script to see what and where the failure happens. This would be alot faster then asking on the boards. Once you pin point the problem and can not understand why it fails we can proceed.
I would also add some return statements under each section of your code.
Code: Select all
if(item.objtype == 0x1f14)
AddRune(who, book, item);
return;
elseif(item.objtype == 0x1f4c);
rechargebook(who, book, item);
return;
else
SendSysMessage(who, "You cant put that in a runebook.");
MoveItemToContainer(item, who.backpack);
endif
This way you do not try to run anything in that if branch. Once it finishes one part if kicks out to the rest of the script.
Posted: Sun Apr 23, 2006 1:46 pm
by Poi
WELL, unmarked runes: 0x1F14, Marked runes: 0x1F15, Now listen though, when i mark a rune, say i bought from a mage, it stays 0x1f14
And if i .create 0x1F15, it wont let me mark it. Let alone put it in a rune book.(prolly cause its unmarked)
Also: May i just delete this? I dont want it to check for charges.
Code: Select all
if(result[0] >= 600)
if(charges < 1)
SendSysMessage(who,"your book is out of charges.");
return;
endif
Posted: Sun Apr 23, 2006 5:43 pm
by DevGIB
only if you want players to be able to keep using the book regardless of charges

Posted: Tue Apr 25, 2006 1:33 pm
by Poi
Alright well, im bumping this topic cause i still need help with this.
Posted: Tue Apr 25, 2006 4:40 pm
by Exar Kun
You're answering your own questions without realizing it. Whomever wrote all that code was a little on the lazy side.
The code that looks for the rune to be objtype 0x1F14 was written by someone who expected players to buy those runes from vendors, not mark the runes themselves. Otherwise, they would have set the script up appropriately.
You can't mark the objtype 0x1F15 probably because that's already been defined as a marked rune. Check the code that does the marking and I'll bet you find it's set up to look for objtype 0x1F14.
These are really typical mistakes made by scripters that don't think about the consequences of their work or just don't know any better. Good luck.
Posted: Tue May 02, 2006 1:11 pm
by Poi
Anyone mind helping me find the marking script? I can't seem to figure it out.
Posted: Tue May 02, 2006 1:27 pm
by MuadDib
Be sure you have all the service packs for 095 Distro (I am assuming you are using that).
Next, put a print(item.objtype); in the code. Why? If I am right, item is null in the insert where it is checking it. That was, or should have been, addressed and fixed in a later Service Pack (2 i think) for 095 Distro.
Posted: Tue May 02, 2006 4:37 pm
by Poi
Ok installed service pack 2. It still does not work, and where would i put that print string? And i see no point for that still.
Posted: Tue May 02, 2006 7:45 pm
by Yukiko
I think you'd put it right before the check for legality of insert. It will print to the console. If you want to see it in game use a SendSysMessage.
Posted: Wed May 03, 2006 2:45 am
by Tritan
Just do a check to see if the item is actually a rune at all. Then check for one of the properties on the rune to verify it has been marked. You should be able to look at the mark.src to see how the rune gets set up with that spell.
You already answered your question above with the objtype issue and it is what I thought it was.
Posted: Wed May 03, 2006 4:26 am
by Poi
OK i looked over my mark.src and i see nothing about changing the obj type..
Code: Select all
use uo;
use util;
include "include/spellRestrictions";
program cast_mark(parms)
var circle := 6;
var delivery := "notarget";
var noto := "neutral";
var result := maincast(parms, delivery, circle, noto, 45);
if(result == 0)
return;
endif
var caster := result[1];
var cast_on := Target(caster);
if (cast_on.objtype != UOBJ_RUNE)
SendSysMessage(caster, "You can only cast that on a recall rune!");
return;
endif
if(caster.multi)
SendSysMessage(caster,"you cant mark runes here");
PlaySoundEffect(caster,0x005d);
PlayObjectCenteredEffect(caster, 0x3735,0x0a, 0x1e);
return;
endif
if(((caster.x >= 5120) && (caster.x <= 5375) && (caster.y >= 0) && (caster.y <= 255)) or (caster.multi))
SendSysMessage(caster, "you cannot mark runes here.");
return;
endif
if (!Accessible(caster, cast_on))
SendSysMessage(caster, "You can't reach that!");
endif
if (cast_on.objtype != UOBJ_RUNE)
SendSysMessage(caster, "You can only cast that on a recall rune!");
return;
endif
if(!ReserveItem(cast_on))
SendSysMessage(caster,"your spell fizzles");
return;
endif
PlayObjectCenteredEffect( caster, FX_MARK_EFFECT, 10, 10);
PlaySoundEffect( caster, SFX_SPELL_MARK );
SetObjProperty(cast_on, "x", caster.x);
SetObjProperty(cast_on, "y", caster.y);
SetObjProperty(cast_on, "z", caster.z);
SetName(cast_on, "a marked recall rune");
endprogram
Would i just add the line:
SetObjProperty(cast_on, "0x1f15", caster.objtype);
Posted: Wed May 03, 2006 7:24 am
by CWO
Poi wrote:OK i looked over my mark.src and i see nothing about changing the obj type..
if (cast_on.objtype != UOBJ_RUNE)
UOBJ_RUNE is the objtype here.
Re: Yet another one of the 100's of problems.
Posted: Wed May 03, 2006 8:37 am
by Tritan
Poi wrote:When i insert runes or anything into a rune book, it just says, You cant put that in a runebook.
Heres the part that makes it say that:
Code: Select all
if(item.objtype == 0x1f14)
AddRune(who, book, item);
elseif(item.objtype == 0x1f4c);
rechargebook(who, book, item);
else
SendSysMessage(who, "You cant put that in a runebook.");
MoveItemToContainer(item, who.backpack);
endif
I would change this to the following.
Code: Select all
if ( item.objtype == UOBJ_RUNE && GetObjProperty (item, "x"))
AddRune(who, book, item);
elseif(item.objtype == 0x1f4c);
rechargebook(who, book, item);
else
SendSysMessage(who, "You cant put that in a runebook.");
MoveItemToContainer(item, who.backpack);
endif
This should take care of this problem. I did not test this but seeing how your mark spell is set up this would take care of the problem.
Now to add in debug messages use this code.
Code: Select all
if ( item.objtype == UOBJ_RUNE && GetObjProperty (item, "x"))
SendSysMessage (who, "item type is " + item.objtype);
AddRune(who, book, item);
elseif(item.objtype == 0x1f4c);
rechargebook(who, book, item);
else
SendSysMessage(who, "You cant put that in a runebook.");
MoveItemToContainer(item, who.backpack);
endif
Posted: Wed May 03, 2006 2:28 pm
by Poi
"Variable UOBJ_RUNE ahs not been declared" thats the error i get.
Posted: Wed May 03, 2006 3:42 pm
by Tritan
You will have to add an include to your script for this to work. Someplace in your mark.src you are calling this out. I have a feeling it in one of the includes tied to include "include/spellRestrictions".
Posted: Wed May 03, 2006 3:59 pm
by Poi
Well i know whaty your going to say.. "close the book" or something.. btu now its syaing you can't add thatw hile the book is in use.. but its not.. and the rune never goes backt o my pack.. just dissapears
Posted: Thu May 04, 2006 9:58 am
by Tritan
The book or the rune?
The way my rune book works is a button on the gump to start the add function. If you are using inscription that might be handled different.
Posted: Thu May 04, 2006 10:12 am
by Yukiko
I had that same "cannot insert while book is in use" problem while converting Distro 95 POL 96. Niether one, book or rune, was in use. I finally gave up and found an older runebook script and used it with no problem after adding a few includes and stuff.
I understand your frustration Poi.
Posted: Thu May 04, 2006 4:14 pm
by kylee
Why not give him the script then
Posted: Fri May 05, 2006 12:03 pm
by Yukiko
Kylee, I didn't offer the script for several reasons.
1. I think the developer of the POL 95 Distro runebook script which is giving so much headache should help out here and fix it. That's assuming the author of that script is still around.
2. The script I have isn't just a plug n' play script. It is integrated deeply into my old shard and I had to drop in a few packages/includes just to get it to compile. I plan on cleaning it up later.
3. I am sure I have a clean version of it somewhere but it is written for POL 92 or 94 and would have to be converted to POL 95/96 as I did when I first put it into my shard.
4. And the most inportant reason is he never asked for it.
I know you're new around here. Anyone who has been here a long time knows if I have a script that I can share I do share. Some of the things I have I am not allowed or won't give away.
Posted: Fri May 05, 2006 12:19 pm
by Poi
Well i would apritiate have the script, but i didnt ask for it for a few reasons, first of all me being a scripter for other types of scripting i know i hate to give away scripts i have for nothing and because its a pain to tell people how to install/work it... I know some people are different, they like to share thier scripts and stuff... but not me.