PenUltima Online

It is currently Fri Sep 05, 2008 6:24 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Need Gump Help!
PostPosted: Tue Jul 04, 2006 3:02 pm 
Offline

Joined: Sat Apr 15, 2006 11:50 am
Posts: 66
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 :D

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 4:57 am 
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.


Top
  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 8:36 am 
Offline

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 10:38 am 
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.


Top
  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 11:30 am 
Offline

Joined: Sat Apr 15, 2006 11:50 am
Posts: 66
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 :D
now i exacly now what to do.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: The_Visitor 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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl