Need Gump Help!

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Post Reply
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

Need Gump Help!

Post by Damien »

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: Select all

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 :D

Thanks.
Burtonius

Post by Burtonius »

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.
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

Post by Damien »

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 :(

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 :D

Thanks.
Burtonius

Post by Burtonius »

well maybe this will help.

Code: Select all


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.
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

Post by Damien »

Burtonius wrote:

Code: Select all


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: Select all

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 :D
now i exacly now what to do.

Thanks.
Post Reply