Yet another one of the 100's of problems.

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Yet another one of the 100's of problems.

Post 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
Last edited by Poi on Tue Apr 25, 2006 1:35 pm, edited 1 time in total.
User avatar
Tritan
Grandmaster Poster
Posts: 147
Joined: Sat Feb 04, 2006 8:17 am

Post by Tritan »

Then your objtype is not correct for your rune.
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

Post by Damien »

I got same problem and the objtype match the rune
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Yeah objtype matches
User avatar
Tritan
Grandmaster Poster
Posts: 147
Joined: Sat Feb 04, 2006 8:17 am

Post 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.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post 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
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Post by DevGIB »

only if you want players to be able to keep using the book regardless of charges :|
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Alright well, im bumping this topic cause i still need help with this.
Exar Kun
Novice Poster
Posts: 42
Joined: Wed Apr 19, 2006 12:29 pm

Post 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.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Anyone mind helping me find the marking script? I can't seem to figure it out.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post 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.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post 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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
User avatar
Tritan
Grandmaster Poster
Posts: 147
Joined: Sat Feb 04, 2006 8:17 am

Post 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.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post 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);
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
User avatar
Tritan
Grandmaster Poster
Posts: 147
Joined: Sat Feb 04, 2006 8:17 am

Re: Yet another one of the 100's of problems.

Post 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
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

"Variable UOBJ_RUNE ahs not been declared" thats the error i get.
User avatar
Tritan
Grandmaster Poster
Posts: 147
Joined: Sat Feb 04, 2006 8:17 am

Post 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".
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post 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
User avatar
Tritan
Grandmaster Poster
Posts: 147
Joined: Sat Feb 04, 2006 8:17 am

Post 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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
kylee
New User
Posts: 6
Joined: Thu May 04, 2006 3:58 pm

Post by kylee »

Why not give him the script then
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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.
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post 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.
Post Reply