News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Template for table  (Read 2814 times)

0 Members and 1 Guest are viewing this topic.

Offline gamerzod

  • Jr. Member
  • **
  • Posts: 17
    • View Profile
Template for table
« on: July 11, 2015, 03:14:46 AM »
can some want share in here a template for table with the isbutton,
like daboss supermod, there is table template and we can switch from one option to other
make a little example for like this (please the template with the isbutton press):
1. Weapon: wp1, wp2, wp3, wp4
2. Animation: an1, an2, an2, an2
3. etc...
and i don't want to make other supermod, i just want to learn it, but i still don't get it after reading daboss table tutorial
can someone make a templete for this?

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Template for table
« Reply #1 on: July 11, 2015, 01:21:41 PM »
Well, a table isn't the only thing you need for a menu to work (but it is an important part of an efficient one). Here's some images I just put together explaining everything from variables to tables to how to make a menu. (It took over an hour so I hope you appreciate it you lil shit).
You'll probably need to enlarge the images to read them.

Before moving onto tables, we need to cover variables a bit and how they can only store one value at once. Variables can only have 1 value at once. This is shown in the following image...


Before moving onto tables, you should also get that there are different types of variables. Here's a few:
x = 2 -- x is a variable with a number value.
text = "Here's some text" -- text is a variable with a string value. a string is text in between 2 quotes, the quotes distinguish it from code
missiongRunning = true -- missionRunning is a variable with a boolean value, a boolean is either true or false.
var = nil -- var is a variable with a nil value, which actually means.... no value. This variable stores no value. nil means no value.

A table... is actually just another type of variable. Tables are what we will need to store multiple values in a single variable.
On line 22 I messed up, some of the text isn't showing. It's meant to say "as you can see, we can use the ped handles we stored in the table just like ped handles we'd store in regular variables"


You can set the initial values of a table by filling in the braces too.


A very useful trick that you can do with tables is use a variable to access certain elements of the table. (Ignore the friend who stole my username, didn't realize that got screenshotted)


Now that you get how tables work a bit, let's move onto a different topic for a moment... the basics of menus. This example just shows changing the value of a variable, but you'll need to get it before moving on. (Changed the color to stand out a bit more)


Now back to tables. I have 2 things to show... in one image (save the cyber trees). First the fact that tables, can store tables. Secondly that you can use strings as keys to tables.


Diverting from tables again. Here's another type of variable... one that refers to a function. So far the examples haven't had any functions in them (and thus couldn't be ran) because they haven't needed it to teach what I was trying to teach. This one since it deals with functions does however (but it's still not runnable without MissionSetup).


Using everything you've learned up to this point.... let's try to make a basic menu.


Here's what the style selector part of that could be.


Our menus so far have a few problems though... one, we used the sprint button as a selection button. That means if the player tries to run while using the menu, he'll be selecting things in the menu on accident. Also, the script ends after 1 selection is made and you can't go back in the menu and select another thing. Here, we'll fix all of that.


Topic talking about why the call to Wait was used where it was in the last image: http://www.bully-board.com/index.php?topic=22715.0

The code for the example shown in the last image: http://pastebin.com/pM9r2HL1

I hope this has all helped you, if you have any questions feel free to ask.

Edit: Forgot to include a link to that LUA timing topic.... whoops.
« Last Edit: July 21, 2015, 06:30:41 AM by DaBOSS54320 »

Offline gamerzod

  • Jr. Member
  • **
  • Posts: 17
    • View Profile
Re: Template for table
« Reply #2 on: July 11, 2015, 09:26:49 PM »
Daboss thank you for your teaching but the picture is error

Offline DaBOSS54320

  • Hero Member
  • ****
  • Posts: 3,398
  • Gender: Female
    • View Profile
Re: Template for table
« Reply #3 on: July 11, 2015, 11:05:08 PM »
What's wrong?

Offline SWEGTA

  • Da Forum Luffs Me!
  • *****
  • Posts: 6,423
  • Gender: Male
  • Swee Gee Tee Ayy
    • View Profile
    • Bully & GTA videos
Re: Template for table
« Reply #4 on: July 12, 2015, 01:01:11 PM »
Daboss thank you for your teaching but the picture is error
I can see it just fine. Try deleting your cookies and refresh the page.

Great tutorial btw, pony.
Here! Have an apple.
Pony eating an apple

I remember having trouble with tables.
I got tired of learning, so I just said "Fuck it!" and used locals. BAD IDEA.
Tables are the way to go.

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: Template for table
« Reply #5 on: July 12, 2015, 05:36:43 PM »
Daboss thank you for your teaching but the picture is error
I can see it just fine. Try deleting your cookies and refresh the page.

Great tutorial btw, pony.
Here! Have an apple.
Pony eating an apple

I remember having trouble with tables.
I got tired of learning, so I just said "Fuck it!" and used locals. BAD IDEA.
Tables are the way to go.

Same with me I said fuck tables and just stuck to locals but I am starting to understand the gist of it now.