XenoBot Forums - Powered by vBulletin

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: call a variable that is stored on a .lua file

  1. #1

    Join Date
    Feb 2013
    Location
    brazil
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question call a variable that is stored on a .lua file

    Ok, i have a script made of one-liners. And in the bank action i do have the following script:

    Code:
    Self.SayToNpc({'hi', 'ticket', 'yes', 'deposit all', 'yes'}, 65) wait(1700) Self.SayToNpc({'withdraw'.. ((BuyHP-Self.ItemCount(itemHP))*prieceHP)+((BuyMP-Self.ItemCount(itemMP))*prieceMP)}) wait(500) Self.SayToNpc({'yes'}, 65)

    basically variables like itemHP, itemMP, buyHP... are stored on a .lua file called kazzsetup.lua
    when the script runs i got an error

    PHP Code:
    05:35 XenoScript Error:
               
    Script: [One-Liner executed by XenoBot Walker]
               
    Line #: 1
               
    Chunk: [string ?Self.SayToNpc({'hi''ticket''yes''depo..."]
               Error: attempt to perform arithmetic on global '
    BuyHP' (a nil value)
    This is an error with user-input and should not be reported as a bug with XenoBot. 

    already tried to put dofile('kazzsetup.lua') and dofile("kazzsetup.lua") in the oneliner and it still dont work:

    PHP Code:
    05:34 XenoScript Error:
               
    Script: [One-Liner executed by XenoBot Walker]
               
    Line #: 1
               
    Chunk: [string ?dofile??kazzsetup.lua") Self.SayToNpc({'hi'..."]
               
    Errorattempt to perform arithmetic on global 'BuyMP' (a nil value)
    This is an error with user-input and should not be reported as a bug with XenoBot
    how do i make to import variables from a .lua file to use on the one liners?



    btw how to wrap .lua code on the forum already tried [code=lua] and fail :/
    said no one ever

  2. #2
    Senior Member Bushu's Avatar
    Join Date
    Sep 2011
    Location
    Mexico of the Europe
    Posts
    877
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    lua code:
    one does not simply
    wrap the lua code on forums


    Dziś zrobię coś,
    czego innym sie nie chce.
    Jutro zrobie coś,
    czego inni nie będą w stanie.

  3. #3

    Join Date
    Feb 2013
    Location
    brazil
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tell me or it is just for cool guys? thats gay.
    said no one ever

  4. #4
    Senior Member Bushu's Avatar
    Join Date
    Sep 2011
    Location
    Mexico of the Europe
    Posts
    877
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    To wrap code use [xcode=lua].

    And instead of making a thing like this:
    lua code:
    ((BuyHP-Self.ItemCount(itemHP))*prieceHP)+((BuyMP-Self.ItemCount(itemMP))*prieceMP)


    Try to swap variables with numbers, like change BuyHP for 100(or whatever you want), prieceHP for 45/100/190(depending what health potions you want to use), etc etc.
    Dofile won't work in one liners.


    Dziś zrobię coś,
    czego innym sie nie chce.
    Jutro zrobie coś,
    czego inni nie będą w stanie.

  5. #5

    Join Date
    Feb 2013
    Location
    brazil
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @Bushu yes, i know this works but i want to make on a way that i could release the script on forum with the .lua containing only the setup, so people wouldnt mess on stuff and it would be easier to fit whatver anyone think it could be better
    said no one ever

  6. #6
    Senior Member Bushu's Avatar
    Join Date
    Sep 2011
    Location
    Mexico of the Europe
    Posts
    877
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Then why can't you just do the full .lua file instead of playing with it if you're going to release both .lua and .xbst file?
    That's just my opinion, but I think it would be no sense of doing it your way :P


    Dziś zrobię coś,
    czego innym sie nie chce.
    Jutro zrobie coś,
    czego inni nie będą w stanie.

  7. #7

    Join Date
    Feb 2013
    Location
    brazil
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes i just read that it was possible to do one liners with some functions, so i was just trying to figure out how to make them... well if anyone knows tell me please :P
    also i don't like the label system u.u
    said no one ever

  8. #8
    Senior Member Bushu's Avatar
    Join Date
    Sep 2011
    Location
    Mexico of the Europe
    Posts
    877
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    label system <3
    you can't do it your way I told you ;P
    you have to set up the amount in script yourself


    Dziś zrobię coś,
    czego innym sie nie chce.
    Jutro zrobie coś,
    czego inni nie będą w stanie.

  9. #9

    Join Date
    Feb 2013
    Location
    brazil
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ahh fuck this ok ty for the info rep+
    said no one ever

  10. #10

    Join Date
    Feb 2013
    Location
    brazil
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how come i could dofile('forgee.lua') to use the function reachdepot() and i cant dofile('kazzsetup.lua') to load my variables ?
    said no one ever

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •