PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Need Gump Help!

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095)
Display posts from previous:   

Author Message
Damien



Joined: 15 Apr 2006
Posts: 65

PostPosted: Tue Jul 04, 2006 7:02 pm    Post subject: Need Gump Help! Reply with quote

Hello! I got this question about Gumps.
But first check the ridicolous Gump i made to make this easier.

http://img131.imageshack.us/my.php?image=gumps2gq.jpg

There it is, and to make it even easier i post the code:

Code:

use uo;
use os;

include "include/attributes";

program Gumpquestion( who )

var gflayout := {
      "nodispose",
      "nomove",   
      "page 0",   
                "resizepic 55 105 2620 290 200",
      "text 145 120 32 0", 
      "page 1",        
      "text 80 160 50 1", 
      "text 80 175 50 2",
      "text 80 190 50 3",
      "text 80 205 50 4",
      "text 80 245 50 5",
      "button 300 240 2472 2473 ? ? ?"

      };
var gfdata := {
      "Gump Question!",   
                "My Gump Question, Read Below!",
                "I would be Extremely glad",
                "if someone could help me ;)",
                "Read Question below please!",
      "Click here to get an spellbook"    
      };

SendDialogGump( who, gflayout, gfdata );

endprogram


My question is how to do, when you click the button a spellbook will be
created in your backpack?

Do i need to use another code?

If you know where a guide is, i also would be extremely happy!
Ive already read Lystramons guide though.

But if you help me in here i would be even happier!

Please help me Very Happy

Thanks.

Author Message
Burtonius



Joined: 23 Jun 2006
Posts: 4

PostPosted: Wed Jul 05, 2006 8:57 am    Post subject: Reply with quote

this documentation link:

http://poldoc.fem.tu-ilmenau.de/pol095/index.php

has Lystramon's Gump Tutorial it is a pretty good Gump tut.
I assume you know some stuff about scripting because you were able to create that gump. So the button you put in the layout array has 3 missing parameters. The last one will be the return id. You get an array of return id's from the SendDialogGump() command so just declare a variable to store them in and use your code to check if the button is pressed then make spellbook.

Author Message
Damien



Joined: 15 Apr 2006
Posts: 65

PostPosted: Wed Jul 05, 2006 12:36 pm    Post subject: Reply with quote

hi, thanks for replying.

In general i dont know much about gump scripts,
only thing i know is how to create gumps ;p
(That is the easy part...)

Not to do functions in it and so on...

I've read Lystramons guide over and over again and i understand the most of it...

But i still can't figure out how to do Sad

I dont like this myself, But i would be extremely happy if someone
told me how to do in an easier way ( since im newbie ;p ).

Or if you could re-create the gump script i did up there and do so
it creates a spellbook in characters backpack when clicking on the button.

And its always easier to learn when you got examples :]

I appreciate all replies Very Happy

Thanks.

Author Message
Burtonius



Joined: 23 Jun 2006
Posts: 4

PostPosted: Wed Jul 05, 2006 2:38 pm    Post subject: Reply with quote

well maybe this will help.

Code:


use uo;
use os;

include "include/attributes";

program Gumpquestion( who )

var gflayout := {
      "nodispose",
      "nomove",   
      "page 0",   
      "resizepic 55 105 2620 290 200",
      "text 145 120 32 0",
      "page 1",       
      "text 80 160 50 1",
      "text 80 175 50 2",
      "text 80 190 50 3",
      "text 80 205 50 4",
      "text 80 245 50 5",
      "button 300 240 2472 2473 1 0 10"  // changed the question marks to numbers
       //the first 1 means when they press the button it will close the gump
       //the second number 0 is the page to go to when pressed (if the button is taking the user to a new page)
       //the last number 10 is the return Id

      };
var gfdata := {
      "Gump Question!",   
                "My Gump Question, Read Below!",
                "I would be Extremely glad",
                "if someone could help me ;)",
                "Read Question below please!",
      "Click here to get an spellbook"   
      };

var choice := SendDialogGump( who, gflayout, gfdata ); //store the return value in a var

// if I wrote this the right way you need to look up the objtype for a spellbook on your shard and plug it in for ####.
//then it should create the spellbook in the player's pack if the button is pressed
if(choice[1] = 10)
    CreateItemInContainer(who.backpack, 0x####, 1);
endif

endprogram


I don't know if I did this right because I am not at home with my scripts in front of me. But I think you can get the idea of what is going on here. If you are curious about the return values then I would suggest sticking in some more buttons and using some print statements to see how they work. I usually do that when I forget how they are returned. Let me know if you see anything grossly wrong or can't understand what I did.

Author Message
Damien



Joined: 15 Apr 2006
Posts: 65

PostPosted: Wed Jul 05, 2006 3:30 pm    Post subject: Reply with quote

Burtonius wrote:

Code:


use uo;
use os;

include "include/attributes";

program Gumpquestion( who )

var gflayout := {
      "nodispose",
      "nomove",   
      "page 0",   
      "resizepic 55 105 2620 290 200",
      "text 145 120 32 0",
      "page 1",       
      "text 80 160 50 1",
      "text 80 175 50 2",
      "text 80 190 50 3",
      "text 80 205 50 4",
      "text 80 245 50 5",
      "button 300 240 2472 2473 1 0 10"  // changed the question marks to numbers
       //the first 1 means when they press the button it will close the gump
       //the second number 0 is the page to go to when pressed (if the button is taking the user to a new page)
       //the last number 10 is the return Id

      };
var gfdata := {
      "Gump Question!",   
                "My Gump Question, Read Below!",
                "I would be Extremely glad",
                "if someone could help me ;)",
                "Read Question below please!",
      "Click here to get an spellbook"   
      };

var choice := SendDialogGump( who, gflayout, gfdata ); //store the return value in a var

// if I wrote this the right way you need to look up the objtype for a spellbook on your shard and plug it in for ####.
//then it should create the spellbook in the player's pack if the button is pressed
if(choice[0] == 10)
    CreateItemInContainer(who.backpack, 0x0EFA, 1);
endif

endprogram



Hello again, Thanks there was some small errors which i changed, and now it works!

The error was:
Code:

if(choice[1] = 10) // Now    if(choice[0] == 10)
    CreateItemInContainer(who.backpack, 0x0EFA, 1);
endif

// Just wrote that if anyone else wanted to know :)


Hey i understood everything, a HUGE thanks Very Happy
now i exacly now what to do.

Thanks.

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095) All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty