Guest User

Untitled

a guest
May 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. function gumptest( npc, mobile, forsale, shopping_cart )
  2. var gflayout := {
  3. "page 0",
  4. "nodispose",
  5. "resizepic 0 0 5170 200 300",
  6. "text 40 40 50 0",
  7. "text 40 100 50 1",
  8. "text 40 160 50 2",
  9. "text 40 220 50 3",
  10. "button 100 40 249 248 1 0 0",
  11. "button 100 100 249 248 1 0 0",
  12. "button 100 160 249 248 1 0 0",
  13. "button 100 220 249 248 1 0 0"
  14. };
  15. var gfdata := {"Buy",
  16. "Sell",
  17. "Train",
  18. "Sell Bag"
  19. };
  20.  
  21. var choice := SendDialogGump( mobile, gflayout, gfdata );
  22. var his_choice;
  23. foreach key in ( choice.keys )
  24. his_choice := key;
  25. endforeach
  26.  
  27. var output;
  28. case ( his_choice )
  29. 100: output := "The player chose the button the value of which is 100";
  30. 200: output := "The player chose the button the value of which is 200";
  31. 300: output := "The player chose the button the value of which is 300";
  32. 400: output := "The player chose the button the value of which is 400";
  33. default: output := "The player must have canceled the gump without doing anything";
  34.  
  35. // default means if the value is neither 1 nor any of the radio-values
  36. // [so the player canceled the gump without doing anything]. In this example it doesn't matter
  37. // whether you press the okay-button or not, the values are counted anyways. This is because
  38. // it is not important for this example. If you're writing a gump and want it to work correctly
  39. // you should embed a test if the okay-button was pressed
  40. // [like this: if ( choice[0] == 1 ) <- then the player has pressed the okay-button.
  41. // Why? You should know]
  42. endcase
  43.  
  44.  
  45.  
  46. endfunction
Add Comment
Please, Sign In to add comment